Class: Ruby::List

Inherits:
Aggregate show all
Includes:
Alternation::List, Conversions::List
Defined in:
lib/ruby/list.rb

Direct Known Subclasses

DelimitedList, Prolog, StringConcat

Instance Attribute Summary

Attributes included from Node::Composite

#parent

Instance Method Summary collapse

Methods included from Alternation::List

#<<, #[]=, #pop

Methods included from Conversions::List

#to_array

Methods inherited from Aggregate

#position, #position=, #prolog, #prolog=, #to_ruby

Methods inherited from Node

#<=>, #all_nodes, #column, #length, #row

Methods included from Conversions

included, #to_node

Methods included from Node::Traversal

#has_token?, #has_type?, #has_value?, #is_instance_of?, #left_of?, #matches?, #position?, #right_of?, #select

Methods included from Node::Source

#context, #filename, #line, #lines, #src

Methods included from Node::Composite

included, #root, #root?

Constructor Details

#initialize(elements = nil) ⇒ List

Returns a new instance of List.



11
12
13
# File 'lib/ruby/list.rb', line 11

def initialize(elements = nil)
  self.elements = Array(elements)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



19
20
21
# File 'lib/ruby/list.rb', line 19

def method_missing(method, *args, &block)
  elements.respond_to?(method) ? elements.send(method, *args, &block) : super
end

Instance Method Details

#nodesObject



15
16
17
# File 'lib/ruby/list.rb', line 15

def nodes
  elements
end