Module: DeepCover::Node::Mixin::CanAugmentChildren

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

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

def self.included(base)
  base.has_child_handler('remap_%{name}')
  base.singleton_class.prepend ClassMethods
end

Instance Method Details

#remap_child(child, name = nil) ⇒ Object



30
31
32
33
34
# File 'lib/deep_cover/node/mixin/can_augment_children.rb', line 30

def remap_child(child, name = nil)
  return unless child.is_a?(Parser::AST::Node)
  class_name = Tools.camelize(child.type)
  Node.const_defined?(class_name) ? Node.const_get(class_name) : Node
end