Class: MineSweeper::Turn
- Inherits:
-
Object
- Object
- MineSweeper::Turn
- Defined in:
- lib/mine-sweeper/turn.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
Instance Method Summary collapse
-
#initialize ⇒ Turn
constructor
A new instance of Turn.
- #message ⇒ Object
Constructor Details
#initialize ⇒ Turn
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mine-sweeper/turn.rb', line 7 def initialize print "which row?\n > " @row = gets.chomp.to_i print "which column?\n > " @column = gets.chomp.to_i @action = "x" until action_is_valid? print "which action?\n > " @action = gets.chomp.upcase print "that is not a valid action" unless action_is_valid? end end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/mine-sweeper/turn.rb', line 5 def action @action end |
Instance Method Details
#message ⇒ Object
20 21 22 23 24 |
# File 'lib/mine-sweeper/turn.rb', line 20 def { row: @row, column: @column, action: @action } end |