Class: Ruby::Range

Inherits:
Aggregate show all
Defined in:
lib/ruby/array.rb

Instance Attribute Summary

Attributes included from Node::Composite

#parent

Instance Method Summary collapse

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(left, operator, right) ⇒ Range

Returns a new instance of Range.



13
14
15
16
17
# File 'lib/ruby/array.rb', line 13

def initialize(left, operator, right)
  self.left = left
  self.operator = operator
  self.right = right
end

Instance Method Details

#nodesObject



23
24
25
# File 'lib/ruby/array.rb', line 23

def nodes
  [left, operator, right]
end

#valueObject



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

def value
  operator.token == '..' ? (left.value..right.value) : (left.value...right.value)
end