Class: Bemer::CommonTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/bemer/common_template.rb

Direct Known Subclasses

Template

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#modeObject (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