class Vinber::Translate
Constants
- VALUE_BOOL_LABLE
- VALUE_COMMON_LABLE
- VALUE_LABLE
Public Class Methods
new(klass, attribute, attribute_vinber_key)
click to toggle source
# File lib/vinber/translate.rb, line 8 def initialize(klass, attribute, attribute_vinber_key) @label = { :klass => (klass.is_a?(Class) ? klass.name : klass), :attribute => attribute, :key => attribute_vinber_key } end
Public Instance Methods
label()
click to toggle source
# File lib/vinber/translate.rb, line 16 def label @label ||= %() end
text()
click to toggle source
# File lib/vinber/translate.rb, line 20 def text @text ||= I18n.t((VALUE_LABLE % label), default: nil) || I18n.t((VALUE_COMMON_LABLE % label), default: nil) || I18n.t((VALUE_BOOL_LABLE % label), default: label[:key].to_s.humanize) end
Also aliased as: to_s