Class: I18n::Tasks::Command::Commander
- Inherits:
-
Object
- Object
- I18n::Tasks::Command::Commander
- Includes:
- Logging
- Defined in:
- lib/i18n/tasks/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.
14 15 16 |
# File 'lib/i18n/tasks/command/commander.rb', line 14 def initialize(i18n) @i18n = i18n end |
Instance Attribute Details
#i18n ⇒ Object (readonly)
Returns the value of attribute i18n.
11 12 13 |
# File 'lib/i18n/tasks/command/commander.rb', line 11 def i18n @i18n end |
Instance Method Details
#run(name, opts = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/i18n/tasks/command/commander.rb', line 18 def run(name, opts = {}) log_stderr "#{Rainbow('#StandWith').bg(:blue)}#{Rainbow('Ukraine').bg(:yellow)}" 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 |