Module: DeepCover::Node::Mixin::ChildCanBeEmpty

Defined in:
lib/deep_cover/node/mixin/child_can_be_empty.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.last_empty_positionObject

Ugly hack to pass info from Handler to constructor



7
8
9
# File 'lib/deep_cover/node/mixin/child_can_be_empty.rb', line 7

def last_empty_position
  @last_empty_position
end

Class Method Details

.included(base) ⇒ Object



8
9
10
# File 'lib/deep_cover/node/mixin/child_can_be_empty.rb', line 8

def included(base)
  base.has_child_handler('%{name}_can_be_empty')
end

Instance Method Details

#child_can_be_empty(_child, _name = nil) ⇒ Object



22
23
24
# File 'lib/deep_cover/node/mixin/child_can_be_empty.rb', line 22

def child_can_be_empty(_child, _name = nil)
  false
end

#remap_child(child, name) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/deep_cover/node/mixin/child_can_be_empty.rb', line 13

def remap_child(child, name)
  if child == nil
    if (ChildCanBeEmpty.last_empty_position = child_can_be_empty(child, name))
      return Node::EmptyBody
    end
  end
  super
end