Class: Machinist::Lathe
- Inherits:
-
Object
- Object
- Machinist::Lathe
- Defined in:
- lib/machinist_callbacks.rb
Instance Attribute Summary collapse
-
#after_make_callback ⇒ Object
readonly
Returns the value of attribute after_make_callback.
-
#before_make_callback ⇒ Object
readonly
Returns the value of attribute before_make_callback.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#after_make_callback ⇒ Object (readonly)
Returns the value of attribute after_make_callback.
8 9 10 |
# File 'lib/machinist_callbacks.rb', line 8 def after_make_callback @after_make_callback end |
#before_make_callback ⇒ Object (readonly)
Returns the value of attribute before_make_callback.
8 9 10 |
# File 'lib/machinist_callbacks.rb', line 8 def before_make_callback @before_make_callback end |
Class Method Details
.run_with_before_make(*args) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/machinist_callbacks.rb', line 20 def run_with_before_make(*args) lathe = run_without_before_make(*args) (lathe.object.instance_variable_get(:@before_make_callbacks) || []).each do |callback| lathe.object.instance_eval(&callback) end lathe end |
Instance Method Details
#after_make(&callback) ⇒ Object
14 15 16 |
# File 'lib/machinist_callbacks.rb', line 14 def after_make(&callback) append_callback(:after, callback) end |
#before_make(&callback) ⇒ Object
10 11 12 |
# File 'lib/machinist_callbacks.rb', line 10 def before_make(&callback) append_callback(:before, callback) end |