Module: Motion::Component::Motions

Extended by:
ActiveSupport::Concern
Includes:
ModuleFunctions
Included in:
Motion::Component
Defined in:
lib/motion/component/motions.rb

Defined Under Namespace

Modules: ModuleFunctions

Instance Method Summary collapse

Methods included from ModuleFunctions

#map_motion, #motions, #unmap_motion

Instance Method Details

#process_motion(motion, event = nil) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/motion/component/motions.rb', line 48

def process_motion(motion, event = nil)
  unless (handler = _motion_handlers[motion])
    raise MotionNotMapped.new(self, motion)
  end

  _run_action_callbacks(context: handler) do
    if method(handler).arity.zero?
      send(handler)
    else
      send(handler, event)
    end
  end
end