Class: SplendorGame::Card
- Inherits:
-
ColouredObject
- Object
- ColouredObject
- SplendorGame::Card
- Defined in:
- lib/splendor_game/card.rb
Instance Attribute Summary collapse
-
#colour ⇒ Object
readonly
Returns the value of attribute colour.
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(level, colour, cost, points = 0) ⇒ Card
constructor
A new instance of Card.
Constructor Details
#initialize(level, colour, cost, points = 0) ⇒ Card
Returns a new instance of Card.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/splendor_game/card.rb', line 6 def initialize(level, colour, cost, points = 0) @level = level @points = points @colour = colour @cost, @cost_error = Hash.new(), Hash.new() # if the colour is valid, load it, if not, put it in an error hash cost.each do |key, value| new_key_name = validate_colour(key) if new_key_name==false @cost_error[key] = value else @cost[new_key_name] = value end end end |
Instance Attribute Details
#colour ⇒ Object (readonly)
Returns the value of attribute colour.
4 5 6 |
# File 'lib/splendor_game/card.rb', line 4 def colour @colour end |
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
4 5 6 |
# File 'lib/splendor_game/card.rb', line 4 def cost @cost end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
4 5 6 |
# File 'lib/splendor_game/card.rb', line 4 def level @level end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
4 5 6 |
# File 'lib/splendor_game/card.rb', line 4 def points @points end |