Class: Smartdict::Commands::ListCommand
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Smartdict::Commands::ListCommand
- Includes:
- HasFormatList, Models
- Defined in:
- lib/smartdict/commands/list_command.rb
Constant Summary
Constants inherited from AbstractCommand
Instance Method Summary collapse
Methods included from HasFormatList
Methods inherited from AbstractCommand
arguments, default, #extract_arguments_and_options, help_message, help_syntax_message, help_usage_message, inherited, #initialize, options, prog_name, run, #set_arguments!, #set_arguments_and_options!, set_description, set_name, #set_options!, set_summary, set_syntax, set_usage
Constructor Details
This class inherits a constructor from Smartdict::Commands::AbstractCommand
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/smartdict/commands/list_command.rb', line 26 def execute fetch_opts = { :since => @options[:since], :till => @options[:till], :from_lang => @options[:from], :to_lang => @options[:to], :driver => @options[:driver] } translations = Smartdict::Log.fetch(fetch_opts) puts format.format_list(translations) end |
#format ⇒ Object
38 39 40 41 42 |
# File 'lib/smartdict/commands/list_command.rb', line 38 def format format = Smartdict::FormatManager.find(@options[:format]) raise Smartdict::Error.new("Wrong format: #{@options[:format]}") unless format format end |