Sha256: 69e0e2b34a5fce0787f453b71561ca86059c05430a84b229325d91c9a6723568

Contents?: true

Size: 544 Bytes

Versions: 146

Compression:

Stored size: 544 Bytes

Contents

class TextFilter
  include Simpleton
  include Annotatable

  annotate :filter_name, :description

  def filter(text)
    text
  end

  class << self
    def inherited(subclass)
      subclass.filter_name = subclass.name.to_name('Filter')
    end

    def filter(text)
      instance.filter(text)
    end

    def descendants_names
      descendants.map { |s| s.filter_name }.sort
    end

    def find_descendant(filter_name)
      descendants.each do |s|
        return s if s.filter_name == filter_name
      end
      nil
    end
  end
end

Version data entries

146 entries across 146 versions & 1 rubygems

Version Path
trusty-cms-3.0.2 app/models/text_filter.rb
trusty-cms-3.0.1 app/models/text_filter.rb
trusty-cms-3.0.0 app/models/text_filter.rb
trusty-cms-2.0.26 app/models/text_filter.rb
trusty-cms-2.0.25 app/models/text_filter.rb
trusty-cms-2.0.24 app/models/text_filter.rb