Class: I18n::Processes::Command::Commander
- Inherits:
-
Object
- Object
- I18n::Processes::Command::Commander
- Includes:
- Logging
- Defined in:
- lib/i18n/processes/command/commander.rb
Direct Known Subclasses
Constant Summary
Constants included from Logging
Logging::MUTEX, Logging::PROGRAM_NAME
Instance Attribute Summary collapse
-
#i18n ⇒ Object
readonly
Returns the value of attribute i18n.
Instance Method Summary collapse
-
#initialize(i18n) ⇒ Commander
constructor
A new instance of Commander.
- #run(name, opts = {}) ⇒ Object
Methods included from Logging
log_error, log_stderr, log_verbose, log_warn, program_name, warn_deprecated
Constructor Details
#initialize(i18n) ⇒ Commander
Returns a new instance of Commander.
15 16 17 |
# File 'lib/i18n/processes/command/commander.rb', line 15 def initialize(i18n) @i18n = i18n end |
Instance Attribute Details
#i18n ⇒ Object (readonly)
Returns the value of attribute i18n.
12 13 14 |
# File 'lib/i18n/processes/command/commander.rb', line 12 def i18n @i18n end |
Instance Method Details
#run(name, opts = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/i18n/processes/command/commander.rb', line 19 def run(name, opts = {}) name = name.to_sym public_name = name.to_s.tr '_', '-' log_verbose "task: #{public_name}(#{opts.map { |k, v| "#{k}: #{v.inspect}" } * ', '})" if opts.empty? || method(name).arity.zero? send name else send name, opts end end |