Class: Point

Inherits:
Object
  • Object
show all
Defined in:
lib/my_own_maze/model/point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Point

Returns a new instance of Point.



4
5
6
7
# File 'lib/my_own_maze/model/point.rb', line 4

def initialize(x, y)
  @x = x
  @y = y
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



2
3
4
# File 'lib/my_own_maze/model/point.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y.



2
3
4
# File 'lib/my_own_maze/model/point.rb', line 2

def y
  @y
end

Instance Method Details

#set_position(x, y) ⇒ Object



9
10
11
# File 'lib/my_own_maze/model/point.rb', line 9

def set_position(x, y)
  @x, @y = x, y
end