Class: MM::Peg
- Inherits:
-
Object
- Object
- MM::Peg
- Defined in:
- lib/games/mastermind/peg.rb
Instance Attribute Summary collapse
-
#col ⇒ Object
Returns the value of attribute col.
-
#display_value ⇒ Object
Returns the value of attribute display_value.
-
#row ⇒ Object
Returns the value of attribute row.
Instance Method Summary collapse
- #change_value(new_value) ⇒ Object
-
#initialize(args) ⇒ Peg
constructor
A new instance of Peg.
Constructor Details
#initialize(args) ⇒ Peg
Returns a new instance of Peg.
5 6 7 8 9 |
# File 'lib/games/mastermind/peg.rb', line 5 def initialize(args) @display_value = args.fetch(:display_value, nil) @row = args[:row] @col = args[:col] end |
Instance Attribute Details
#col ⇒ Object
Returns the value of attribute col.
3 4 5 |
# File 'lib/games/mastermind/peg.rb', line 3 def col @col end |
#display_value ⇒ Object
Returns the value of attribute display_value.
3 4 5 |
# File 'lib/games/mastermind/peg.rb', line 3 def display_value @display_value end |
#row ⇒ Object
Returns the value of attribute row.
3 4 5 |
# File 'lib/games/mastermind/peg.rb', line 3 def row @row end |
Instance Method Details
#change_value(new_value) ⇒ Object
11 12 13 |
# File 'lib/games/mastermind/peg.rb', line 11 def change_value(new_value) self.display_value = new_value end |