Class: Glue::Template::Base
- Inherits:
-
Object
- Object
- Glue::Template::Base
- Defined in:
- lib/glue/template/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
- #<<(options) ⇒ Object
- #apply_filters ⇒ Object
-
#initialize(config) ⇒ Base
constructor
A new instance of Base.
- #save(path) ⇒ Object
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/glue/template/base.rb', line 8 def initialize(config) self.config = config self.items = [] self.filters = [] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/glue/template/base.rb', line 5 def config @config end |
#filters ⇒ Object
Returns the value of attribute filters.
6 7 8 |
# File 'lib/glue/template/base.rb', line 6 def filters @filters end |
#items ⇒ Object
Returns the value of attribute items.
4 5 6 |
# File 'lib/glue/template/base.rb', line 4 def items @items end |
Instance Method Details
#<<(options) ⇒ Object
14 15 16 |
# File 'lib/glue/template/base.rb', line 14 def <<() self.items << end |
#apply_filters ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/glue/template/base.rb', line 18 def apply_filters filtered_items = [] items.each do || filters.collect do |f| r = Regexp.new(f, Regexp::MULTILINE|Regexp::EXTENDED|Regexp::IGNORECASE) filtered_items << and break if [:path] =~ r end end filtered_items end |
#save(path) ⇒ Object
31 32 33 |
# File 'lib/glue/template/base.rb', line 31 def save(path) raise "This is an abstract method; override it!" end |