Class: Text2048::Tile
- Inherits:
-
Object
- Object
- Text2048::Tile
- Extended by:
- Forwardable
- Defined in:
- lib/text2048/tile.rb
Overview
2048 tile
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #clear_status ⇒ Object
-
#initialize(value, status = nil) ⇒ Tile
constructor
A new instance of Tile.
- #merged? ⇒ Boolean
Constructor Details
#initialize(value, status = nil) ⇒ Tile
Returns a new instance of Tile.
14 15 16 17 |
# File 'lib/text2048/tile.rb', line 14 def initialize(value, status = nil) @value = value @status = status end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/text2048/tile.rb', line 10 def status @status end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/text2048/tile.rb', line 9 def value @value end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 |
# File 'lib/text2048/tile.rb', line 28 def ==(other) @value.to_i == other.to_i end |
#clear_status ⇒ Object
19 20 21 22 |
# File 'lib/text2048/tile.rb', line 19 def clear_status @status = nil self end |
#merged? ⇒ Boolean
24 25 26 |
# File 'lib/text2048/tile.rb', line 24 def merged? @status == :merged end |