lib/mutant/ast/named_children.rb in mutant-0.8.0 vs lib/mutant/ast/named_children.rb in mutant-0.8.1
- old
+ new
@@ -9,14 +9,11 @@
# @param [Class, Module] host
#
# @return [undefined]
#
# @api private
- #
def self.included(host)
- super
-
host.class_eval do
include InstanceMethods
extend ClassMethods
end
end
@@ -24,16 +21,15 @@
# Methods mixed int ot instance level
module InstanceMethods
private
- # Return children
+ # Mutated nodes children
#
# @return [Array<Parser::AST::Node]
#
# @api private
- #
def children
node.children
end
end # InstanceMethods
@@ -49,11 +45,10 @@
# @param [Fixnum] index
#
# @return [undefined]
#
# @api private
- #
def define_named_child(name, index)
define_method(name) do
children.at(index)
end
end
@@ -63,11 +58,10 @@
# @param [Array<Symbol>] names
#
# @return [undefined]
#
# @api private
- #
def define_remaining_children(names)
define_method(:remaining_children_with_index) do
children.each_with_index.drop(names.length)
end
@@ -83,10 +77,9 @@
# Create name helpers
#
# @return [undefined]
#
# @api private
- #
def children(*names)
names.each_with_index do |name, index|
define_named_child(name, index)
end
define_remaining_children(names)