Class: Cardigan::Command::UnclaimCards
- Inherits:
-
Object
- Object
- Cardigan::Command::UnclaimCards
- Defined in:
- lib/cardigan/command/unclaim_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) ⇒ UnclaimCards
constructor
A new instance of UnclaimCards.
Constructor Details
#initialize(repository, io) ⇒ UnclaimCards
Returns a new instance of UnclaimCards.
4 5 6 7 8 |
# File 'lib/cardigan/command/unclaim_cards.rb', line 4 def initialize repository, io @repository, @io = repository, io @usage = '<number> [<number]*' @help = 'Removes the owner of the specified cards' end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
2 3 4 |
# File 'lib/cardigan/command/unclaim_cards.rb', line 2 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
2 3 4 |
# File 'lib/cardigan/command/unclaim_cards.rb', line 2 def usage @usage end |
Instance Method Details
#execute(numbers) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/cardigan/command/unclaim_cards.rb', line 10 def execute numbers @repository.each_card_from_indices(numbers || '') do |card| @io.say "unclaiming \"#{card['name']}\"" card.delete('owner') @repository[card.id] = card end end |