Class: Cardigan::Command::ClaimCards
- Inherits:
-
Object
- Object
- Cardigan::Command::ClaimCards
- Defined in:
- lib/cardigan/command/claim_cards.rb
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
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.
6 7 8 9 10 |
# File 'lib/cardigan/command/claim_cards.rb', line 6 def initialize repository, io, name @repository, @io, @name = repository, io, name @usage = '<number>*' @help = 'Sets you as the owner of the specified cards (by index in the list)' end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
4 5 6 |
# File 'lib/cardigan/command/claim_cards.rb', line 4 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
4 5 6 |
# File 'lib/cardigan/command/claim_cards.rb', line 4 def usage @usage end |
Instance Method Details
#execute(numbers) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/cardigan/command/claim_cards.rb', line 12 def execute numbers @repository.each_card_from_indices(numbers || '') do |card| @io.say "claiming \"#{card['name']}\"" card['owner'] = @name @repository[card.id] = card end end |