class I18n::Tasks::Command::Commander

Attributes

i18n[R]

Public Class Methods

new(i18n) click to toggle source

@param [I18n::Tasks::BaseTask] i18n

# File lib/i18n/tasks/command/commander.rb, line 14
def initialize(i18n)
  @i18n = i18n
end

Public Instance Methods

run(name, opts = {}) click to toggle source
# File lib/i18n/tasks/command/commander.rb, line 18
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

Protected Instance Methods

terminal_report() click to toggle source
# File lib/i18n/tasks/command/commander.rb, line 31
def terminal_report
  @terminal_report ||= I18n::Tasks::Reports::Terminal.new(i18n)
end