Class: Bemer::CommonTemplate
- Inherits:
-
Object
- Object
- Bemer::CommonTemplate
- Defined in:
- lib/bemer/common_template.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
- #apply!(node) ⇒ Object
-
#initialize(mode) ⇒ CommonTemplate
constructor
A new instance of CommonTemplate.
Constructor Details
#initialize(mode) ⇒ CommonTemplate
Returns a new instance of CommonTemplate.
7 8 9 |
# File 'lib/bemer/common_template.rb', line 7 def initialize(mode) @mode = mode.to_s.sub('add_', '').to_sym end |
Instance Attribute Details
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
5 6 7 |
# File 'lib/bemer/common_template.rb', line 5 def mode @mode end |
Instance Method Details
#apply!(node) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/bemer/common_template.rb', line 11 def apply!(node) case mode when Pipeline::REPLACE_MODE then replace!(node) when Pipeline::CONTENT_MODE then node.add_child_nodes else node.public_send(mode) end end |