Class: Cardigan::Command::FilterCards
- Defined in:
- lib/cardigan/command/filter_cards.rb
Instance Attribute Summary
Attributes inherited from ListCards
Instance Method Summary collapse
- #execute(filter) ⇒ Object
-
#initialize(repository, io) ⇒ FilterCards
constructor
A new instance of FilterCards.
Constructor Details
#initialize(repository, io) ⇒ FilterCards
Returns a new instance of FilterCards.
4 5 6 7 8 |
# File 'lib/cardigan/command/filter_cards.rb', line 4 def initialize repository, io super @usage = '<ruby expression>' @help = "Sets the filter on cards to be displayed\nThis filter is a ruby expression that must return a boolean.\nBound variables are card (a hash) and me (a string)" end |
Instance Method Details
#execute(filter) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/cardigan/command/filter_cards.rb', line 10 def execute filter @repository.filter = filter begin super rescue Exception => e @io.say "Invalid expression:\n#{e.}" @repository.filter = nil end end |