Class: Preserve::Callback
- Inherits:
-
Object
- Object
- Preserve::Callback
- Defined in:
- lib/preserve/callback.rb
Instance Method Summary collapse
- #before(controller) ⇒ Object
-
#initialize(source_class, parameter_key, options) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(source_class, parameter_key, options) ⇒ Callback
Returns a new instance of Callback.
9 10 11 12 13 |
# File 'lib/preserve/callback.rb', line 9 def initialize(source_class, parameter_key, ) @source_class = source_class @parameter_key = parameter_key @options = end |
Instance Method Details
#before(controller) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/preserve/callback.rb', line 15 def before(controller) @controller = controller if parameter_blank? parameter_stored? ? restore_parameter : set_default_value else store_parameter end end |