Module: Ruby::Node::Composite
- Included in:
- Ruby::Node, Array
- Defined in:
- lib/ruby/node/composite.rb
Defined Under Namespace
Classes: Array
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
57 58 59 |
# File 'lib/ruby/node/composite.rb', line 57 def parent @parent end |
Class Method Details
.included(target) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ruby/node/composite.rb', line 39 def self.included(target) target.class_eval do class << self def child_accessor(*names, &block) names.each do |name| attr_reader name define_method("#{name}=") do |value| value = Composite::Array.new(value) if value.is_a?(::Array) value.parent = self if value instance_variable_set(:"@#{name}", value) yield(value) if block_given? end end end end end end |