class WindowTerminal::Orientation
A class which stores the Orientation
of an object.
Attributes
x[R]
y[R]
Public Class Methods
new(x=0,y=0)
click to toggle source
Initializes an Orienation object.
# File lib/accu-window.rb, line 51 def initialize(x=0,y=0) if x != -1 and x != 0 and x != 1 then x = 0 end if y != -1 and y != 0 and y != 1 then y = 0 end @x = x @y = y end
Public Instance Methods
[](index)
click to toggle source
Allows for array-like indexing. 0 - @x, 1 - @y
# File lib/accu-window.rb, line 70 def [](index) assert RangeError "Index must be either 0 or 1!" if not (index == 0 or index == 1) if index == 0 then return @x.dup else return @y.dup end end
to_s()
click to toggle source
Makes the to_s
return a more “bootiful” string.
# File lib/accu-window.rb, line 64 def to_s "#{@x}|#{@y}" end