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