Class: CoopAl::Loot
- Inherits:
-
Object
- Object
- CoopAl::Loot
- Defined in:
- lib/coop_al/loot.rb
Overview
Loot
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#treasures ⇒ Object
readonly
Returns the value of attribute treasures.
Class Method Summary collapse
Instance Method Summary collapse
- #+(other) ⇒ Object
- #add_item(item) ⇒ Object
- #add_treasure(treasure) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(treasures, items) ⇒ Loot
constructor
A new instance of Loot.
- #treasure_value ⇒ Object
Constructor Details
#initialize(treasures, items) ⇒ Loot
Returns a new instance of Loot.
8 9 10 11 |
# File 'lib/coop_al/loot.rb', line 8 def initialize(treasures, items) @treasures = treasures @items = items end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
6 7 8 |
# File 'lib/coop_al/loot.rb', line 6 def items @items end |
#treasures ⇒ Object (readonly)
Returns the value of attribute treasures.
6 7 8 |
# File 'lib/coop_al/loot.rb', line 6 def treasures @treasures end |
Class Method Details
Instance Method Details
#+(other) ⇒ Object
27 28 29 30 31 |
# File 'lib/coop_al/loot.rb', line 27 def +(other) @treasures += other.treasures @items += other.items self end |
#add_item(item) ⇒ Object
23 24 25 |
# File 'lib/coop_al/loot.rb', line 23 def add_item(item) @items << item end |
#add_treasure(treasure) ⇒ Object
19 20 21 |
# File 'lib/coop_al/loot.rb', line 19 def add_treasure(treasure) @treasures << treasure end |
#empty? ⇒ Boolean
13 14 15 16 17 |
# File 'lib/coop_al/loot.rb', line 13 def empty? return false unless @treasures.empty? return false unless @items.empty? true end |