class Aerogel::I18n::Chainable

Chainable t helper support class. Example:

t.aerogel.admin.welcome # => t 'aerogel.admin.welcome'
t.aerogel.admin.welcome username: 'John' # => t 'aerogel.admin.welcome', username: 'John'

Public Class Methods

new( *args ) click to toggle source
# File lib/aerogel/core/i18n.rb, line 107
def initialize( *args )
  @path = []
  call( *args ) if args.size > 0
end

Public Instance Methods

call( *args ) click to toggle source
# File lib/aerogel/core/i18n.rb, line 121
def call( *args )
  ::I18n.t translation_key, *args
end
method_missing( name, *args ) click to toggle source
# File lib/aerogel/core/i18n.rb, line 112
def method_missing( name, *args )
  @path << name.to_sym
  if args.size > 0
    call( *args )
  else
    self
  end
end
to_s() click to toggle source
# File lib/aerogel/core/i18n.rb, line 125
def to_s()
  ::I18n.t translation_key
end
translation_key() click to toggle source
# File lib/aerogel/core/i18n.rb, line 129
def translation_key
  @path.join(".")
end