Class: TextFilter

Inherits:
Object
  • Object
show all
Includes:
Annotatable, Simpleton
Defined in:
app/models/text_filter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Annotatable

included

Methods included from Simpleton

included

Class Method Details

.descendants_namesObject



25
26
27
# File 'app/models/text_filter.rb', line 25

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

.description_file(filename) ⇒ Object



20
21
22
23
# File 'app/models/text_filter.rb', line 20

def description_file(filename)
  text = File.read(filename) rescue ""
  self.description text
end

.filter(text) ⇒ Object



16
17
18
# File 'app/models/text_filter.rb', line 16

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

.find_descendant(filter_name) ⇒ Object



29
30
31
32
33
34
# File 'app/models/text_filter.rb', line 29

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

.inherited(subclass) ⇒ Object



12
13
14
# File 'app/models/text_filter.rb', line 12

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

Instance Method Details

#filter(text) ⇒ Object



7
8
9
# File 'app/models/text_filter.rb', line 7

def filter(text)
  text
end