Class: DataMapper::Validations::FieldNameTranslator::Callback
- Inherits:
-
Object
- Object
- DataMapper::Validations::FieldNameTranslator::Callback
- Defined in:
- lib/data_mapper/validations/i18n.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#context ⇒ Object
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context, &cb) ⇒ Callback
constructor
A new instance of Callback.
- #translate(field) ⇒ Object
Constructor Details
#initialize(context, &cb) ⇒ Callback
Returns a new instance of Callback.
48 49 50 51 |
# File 'lib/data_mapper/validations/i18n.rb', line 48 def initialize(context, &cb) self.context = context self.callback = cb end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
46 47 48 |
# File 'lib/data_mapper/validations/i18n.rb', line 46 def callback @callback end |
#context ⇒ Object
Returns the value of attribute context.
46 47 48 |
# File 'lib/data_mapper/validations/i18n.rb', line 46 def context @context end |
Instance Method Details
#translate(field) ⇒ Object
53 54 55 |
# File 'lib/data_mapper/validations/i18n.rb', line 53 def translate(field) self.callback.call(field) end |