Module: ActiveMethod::ClassMethods
- Defined in:
- lib/active_method.rb
Instance Method Summary collapse
Instance Method Details
#active_method(name, method_class = nil, **options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/active_method.rb', line 15 def active_method(name, method_class = nil, **) method_class ||= Util.constantize self, Util.camel_case(name) if [:class_method] define_singleton_method name do |*args, &block| method_class[self].call(*args, &block) end else define_method name do |*args, &block| method_class[self].call(*args, &block) end if [:module_function] module_function name end end end |