class Fir::Cursor
Attributes
x[R]
y[R]
Public Class Methods
blank()
click to toggle source
# File lib/fir/cursor.rb, line 14 def self.blank new(0, 0) end
new(x, y)
click to toggle source
# File lib/fir/cursor.rb, line 9 def initialize(x, y) @x = x @y = y end
Public Instance Methods
==(other)
click to toggle source
# File lib/fir/cursor.rb, line 38 def ==(other) other.x == x && other.y == y end
blank?()
click to toggle source
# File lib/fir/cursor.rb, line 42 def blank? x.zero? && y.zero? end
clone()
click to toggle source
# File lib/fir/cursor.rb, line 18 def clone self.class.new(x, y) end
down()
click to toggle source
# File lib/fir/cursor.rb, line 26 def down self.class.new(x, y + 1) end
left(n)
click to toggle source
# File lib/fir/cursor.rb, line 30 def left(n) self.class.new(x - n, y) end
right(n)
click to toggle source
# File lib/fir/cursor.rb, line 34 def right(n) self.class.new(x + n, y) end
up()
click to toggle source
# File lib/fir/cursor.rb, line 22 def up self.class.new(x, y - 1) end