Class: MM::Peg

Inherits:
Object
  • Object
show all
Defined in:
lib/games/mastermind/peg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colObject

Returns the value of attribute col.



3
4
5
# File 'lib/games/mastermind/peg.rb', line 3

def col
  @col
end

#display_valueObject

Returns the value of attribute display_value.



3
4
5
# File 'lib/games/mastermind/peg.rb', line 3

def display_value
  @display_value
end

#rowObject

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