Sha256: e964480b75449abad7278e0caf70d6ceea3860d657d1ea86a3ce6e6cdff7caa7

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

module SplendorGame
  
  #Players become eligible for Nobles when they have cards that meet the cost (NOT tokens)
  class Noble < ColouredObject
    attr_reader :cost, :points
  
    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
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
splendor_game-0.1.1 lib/splendor_game/noble.rb
splendor_game-0.1.0 lib/splendor_game/noble.rb