Module: Bemer::ContextExtentions::Structure

Defined in:
lib/bemer/context_extentions/structure.rb

Instance Method Summary collapse

Instance Method Details

#content(**options) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/bemer/context_extentions/structure.rb', line 6

def content(**options)
  old_params = Hash[node.params]

  node.params.merge!(options)

  node.add_child_nodes
ensure
  node.params = old_params
end

#ctx(**options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bemer/context_extentions/structure.rb', line 16

def ctx(**options)
  duplicate = node.dup

  duplicate.params.merge!(options)

  bem_cascade                          = node.tree.parent_node.bem_cascade
  duplicate.entity.bem_cascade         = bem_cascade
  duplicate.entity_builder.bem_cascade = bem_cascade

  node.tree.add(duplicate)

  nil
end