Class: Cardigan::Command::ClaimCards
- Inherits:
-
Object
- Object
- Cardigan::Command::ClaimCards
- Defined in:
- lib/cardigan/command/claim_cards.rb
Instance Method Summary collapse
- #execute(numbers) ⇒ Object
-
#initialize(repository, io, name) ⇒ ClaimCards
constructor
A new instance of ClaimCards.
Constructor Details
#initialize(repository, io, name) ⇒ ClaimCards
Returns a new instance of ClaimCards.
4 5 6 |
# File 'lib/cardigan/command/claim_cards.rb', line 4 def initialize repository, io, name @repository, @io, @name = repository, io, name end |
Instance Method Details
#execute(numbers) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/cardigan/command/claim_cards.rb', line 8 def execute numbers @repository.each_card_from_indices(numbers) do |card| @io.say "claiming \"#{card['name']}\"" card['owner'] = @name @repository.save card end end |