module I18n::Tasks::Command::DSL::ClassMethods
Public Instance Methods
arg(ref, *args)
click to toggle source
# File lib/i18n/tasks/command/dsl.rb, line 28 def arg(ref, *args) if args.present? dsl(:args)[ref] = args else dsl(:args)[ref] end end
cmd(name, conf = nil)
click to toggle source
# File lib/i18n/tasks/command/dsl.rb, line 18 def cmd(name, conf = nil) if conf conf = conf.dup conf[:args] = (conf[:args] || []).map { |arg| arg.is_a?(Symbol) ? arg(arg) : arg } dsl(:cmds)[name] = conf else dsl(:cmds)[name] end end
cmds()
click to toggle source
# File lib/i18n/tasks/command/dsl.rb, line 36 def cmds dsl(:cmds) end
dsl(key)
click to toggle source
# File lib/i18n/tasks/command/dsl.rb, line 40 def dsl(key) @dsl[key] end
included(base)
click to toggle source
if class is a module, merge DSL
definitions when it is included
# File lib/i18n/tasks/command/dsl.rb, line 50 def included(base) base.instance_variable_get(:@dsl).deep_merge!(@dsl) end
t(*args, **kwargs)
click to toggle source
late-bound I18n.t for module bodies
# File lib/i18n/tasks/command/dsl.rb, line 45 def t(*args, **kwargs) proc { I18n.t(*args, **kwargs) } end