Class: Cardigan::Command::SpecifyDisplayColumns
- Defined in:
- lib/cardigan/command/specify_display_columns.rb
Instance Attribute Summary
Attributes inherited from ListCards
Instance Method Summary collapse
- #execute(text) ⇒ Object
-
#initialize(repository, io) ⇒ SpecifyDisplayColumns
constructor
A new instance of SpecifyDisplayColumns.
Constructor Details
#initialize(repository, io) ⇒ SpecifyDisplayColumns
Returns a new instance of SpecifyDisplayColumns.
4 5 6 7 8 |
# File 'lib/cardigan/command/specify_display_columns.rb', line 4 def initialize repository, io super @usage = '<column>*' @help = 'Specify the list of columns to display' end |
Instance Method Details
#execute(text) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/cardigan/command/specify_display_columns.rb', line 10 def execute text if text @repository.display_columns = text.scan(/\w+/) super else @io.say "current columns: #{@repository.display_columns.join(',')}" @io.say "available columns: #{@repository.columns.sort.join(',')}" end end |