Module: Vinber::Value
- Defined in:
- lib/vinber/vinber_value.rb
Instance Method Summary collapse
Instance Method Details
#vinber_value(attribute, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/vinber/vinber_value.rb', line 4 def vinber_value(attribute, = {}) obj = self klass = obj.class val = obj.send(attribute.to_sym) api = .fetch(:t) {false} if klass.vinber_defined?(attribute) && (attribute_vinber = klass.defined_vinbers[attribute.to_s]).is_a?(Hash) attribute_vinber_key = attribute_vinber.key val api ? attribute_vinber_key.to_s : Vinber::Translate.new(klass, attribute, attribute_vinber_key).to_s else val end end |