Class: EacRubyUtils::ActsAsInstanceMethod
- Defined in:
- lib/eac_ruby_utils/acts_as_instance_method.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#default_sender_module ⇒ Module
30 31 32 |
# File 'lib/eac_ruby_utils/acts_as_instance_method.rb', line 30 def default_sender_module method_class.module_parent end |
#method_name ⇒ String
25 26 27 |
# File 'lib/eac_ruby_utils/acts_as_instance_method.rb', line 25 def method_name method_class.name.demodulize.underscore.variableize end |
#setup(sender_module = nil) ⇒ self
14 15 16 17 18 19 20 21 22 |
# File 'lib/eac_ruby_utils/acts_as_instance_method.rb', line 14 def setup(sender_module = nil) sender_module ||= default_sender_module the_setup = self sender_module.define_method(method_name) do |*args, &block| the_setup.method_class.new(self, *args, &block).result end self end |