Class: Gloomhaven::Perk
- Inherits:
-
Object
- Object
- Gloomhaven::Perk
- Defined in:
- lib/gloomhaven/perk.rb
Instance Attribute Summary collapse
-
#adds ⇒ Object
readonly
Returns the value of attribute adds.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#removes ⇒ Object
readonly
Returns the value of attribute removes.
Instance Method Summary collapse
-
#cards ⇒ Object
returns a hash of card objects Ex: Perk.new.cards => { add: [Card, Card], remove: [Card, Card, Card] }.
-
#initialize(key) ⇒ Perk
constructor
A new instance of Perk.
Constructor Details
Instance Attribute Details
#adds ⇒ Object (readonly)
Returns the value of attribute adds.
3 4 5 |
# File 'lib/gloomhaven/perk.rb', line 3 def adds @adds end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/gloomhaven/perk.rb', line 3 def description @description end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/gloomhaven/perk.rb', line 3 def key @key end |
#removes ⇒ Object (readonly)
Returns the value of attribute removes.
3 4 5 |
# File 'lib/gloomhaven/perk.rb', line 3 def removes @removes end |
Instance Method Details
#cards ⇒ Object
returns a hash of card objects Ex: Perk.new.cards => { add: [Card, Card], remove: [Card, Card, Card] }
19 20 21 22 23 24 |
# File 'lib/gloomhaven/perk.rb', line 19 def cards result = { 'add' => [], 'remove' => [] } adds.each { |effect| result['add'] = 1.upto(effect['count']).map { Card.new(effect['card_name']) } } removes.each { |effect| result['remove'] = 1.upto(effect['count']).map { Card.new(effect['card_name']) } } result end |