Class: SplendorGame::Noble
- Inherits:
-
ColouredObject
- Object
- ColouredObject
- SplendorGame::Noble
- Defined in:
- lib/splendor_game/noble.rb
Overview
Players become eligible for Nobles when they have cards that meet the cost (NOT tokens)
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(cost, points = 0) ⇒ Noble
constructor
A new instance of Noble.
Constructor Details
#initialize(cost, points = 0) ⇒ Noble
Returns a new instance of Noble.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/splendor_game/noble.rb', line 7 def initialize(cost, points = 0) @points = points @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 |