Sha256: 247185ed739a0dbea8f8c53ca5db1e351fe639f3445fa7677e3fa02d8e4827cc
Contents?: true
Size: 804 Bytes
Versions: 13
Compression:
Stored size: 804 Bytes
Contents
module Gloomhaven class Card attr_reader :attack, :crit, :miss, :name, :shuffle def initialize(name) raise ArgumentError.new('Name must be a string') unless name.is_a?(String) card_data = CARDS.detect { |card| card['name'].downcase == name.downcase } validate!(card_data) @name = card_data['name'] @attack = card_data['attack'] @crit = card_data['crit'] == true @miss = card_data['miss'] == true @rolling = card_data['rolling'] == true @shuffle = card_data['shuffle'] == true end def bless? name.downcase == 'bless' end def curse? name.downcase == 'curse' end def rolling? @rolling end private def validate!(data) raise CardNotFoundError.new unless data end end end
Version data entries
13 entries across 13 versions & 1 rubygems