Class: Legion::Cli::Chain
- Inherits:
-
Thor
- Object
- Thor
- Legion::Cli::Chain
- Defined in:
- lib/legion/cli/chain.rb
Instance Method Summary collapse
Instance Method Details
#create(name) ⇒ Object
5 6 7 8 |
# File 'lib/legion/cli/chain.rb', line 5 def create(name) Legion::Service.new(cache: false, crypt: false, extensions: false, log_level: 'error') say "chain created, id: #{Legion::Data::Model::Chain.insert({ name: name })}", :green end |
#delete(id) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/legion/cli/chain.rb', line 24 def delete(id) Legion::Service.new(cache: false, crypt: false, extensions: false, log_level: 'error') return if ![:confirm] && !(yes? "Are you sure you want to delete chain #{id} and all dependent relationships", :red) Legion::Data::Model::Chain[id].delete say 'Deleted!' end |
#show ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/legion/cli/chain.rb', line 12 def show Legion::Service.new(cache: false, crypt: false, extensions: false, log_level: 'error') rows = [%w[id name active]] Legion::Data::Model::Chain.limit([:limit]).order(:id).reverse_each do |row| rows.push([row.values[:id], row.values[:name], row.values[:active]]) end print_table rows end |