Module: CoAspects::Callbacks
- Defined in:
- lib/co_aspects/callbacks.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/co_aspects/callbacks.rb', line 8 def method_missing(method_name, *args, &block) return super unless /\A_/ =~ method_name args.each { |arg| fail InvalidArgument.new(arg) unless arg.kind_of?(Hash) } = Hash[*args.map(&:to_a).flatten] (@__aspects_attacher__ ||= Attacher.new).add(method_name, , block) end |