Class: VeryGood::State
- Inherits:
-
Object
- Object
- VeryGood::State
- Defined in:
- lib/very_good/state.rb
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(width:, height:, state: nil, cursor: Cursor.new(0, 0)) ⇒ State
constructor
A new instance of State.
- #lines ⇒ Object
- #set(x, y, cell) ⇒ Object
- #set_cursor(new_cursor) ⇒ Object
Constructor Details
#initialize(width:, height:, state: nil, cursor: Cursor.new(0, 0)) ⇒ State
Returns a new instance of State.
3 4 5 6 7 8 |
# File 'lib/very_good/state.rb', line 3 def initialize(width:, height:, state: nil, cursor: Cursor.new(0, 0)) @width = width @height = height @state = state || clean_state @cursor = cursor end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
10 11 12 |
# File 'lib/very_good/state.rb', line 10 def cursor @cursor end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
10 11 12 |
# File 'lib/very_good/state.rb', line 10 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
10 11 12 |
# File 'lib/very_good/state.rb', line 10 def width @width end |
Instance Method Details
#lines ⇒ Object
36 37 38 |
# File 'lib/very_good/state.rb', line 36 def lines @state end |