Class: Cardigan::Command::ListCards
- Inherits:
-
Object
- Object
- Cardigan::Command::ListCards
- Defined in:
- lib/cardigan/command/list_cards.rb
Direct Known Subclasses
FilterCards, SpecifyDisplayColumns, SpecifySortColumns, UnfilterCards
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(text) ⇒ Object
-
#initialize(repository, io) ⇒ ListCards
constructor
A new instance of ListCards.
Constructor Details
#initialize(repository, io) ⇒ ListCards
Returns a new instance of ListCards.
7 8 9 10 11 |
# File 'lib/cardigan/command/list_cards.rb', line 7 def initialize repository, io @repository, @io = repository, io @usage = '' @help = 'Lists all cards that match the current filter' end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
5 6 7 |
# File 'lib/cardigan/command/list_cards.rb', line 5 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
5 6 7 |
# File 'lib/cardigan/command/list_cards.rb', line 5 def usage @usage end |
Instance Method Details
#execute(text) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cardigan/command/list_cards.rb', line 13 def execute text cards = @repository.cards if cards.empty? @io.say "There are no cards to display" return end formatter = Cardigan::TextReportFormatter.new @io @repository.display_columns.each do |column| formatter.add_column(column, @repository.max_field_length(column)) end formatter.output cards end |