Module: Languages::Generic::Position::ClassMethods

Defined in:
lib/languages/generic/position.rb

Instance Method Summary collapse

Instance Method Details

#[](x, y) ⇒ Object



9
10
11
12
13
# File 'lib/languages/generic/position.rb', line 9

def [](x,y)
  o = new
  o.x,o.y = x,y
  o
end

#from_array(ary) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/languages/generic/position.rb', line 15

def from_array(ary)
  x, y = ary.pop(2)
  x = Languages::Generic::Dots.new(x) if x.is_a? Integer
  y = Languages::Generic::Dots.new(y) if y.is_a? Integer          
  o = new
  o.x,o.y = x,y
  o
end