module Motion::Component::Motions

Constants

DEFAULT

Attributes

_motion_handlers[W]

Public Instance Methods

_motion_handlers() click to toggle source
# File lib/motion/component/motions.rb, line 38
def _motion_handlers
  return @_motion_handlers if defined?(@_motion_handlers)
  return superclass._motion_handlers if superclass.respond_to?(:_motion_handlers)

  DEFAULT
end
process_motion(motion, event = nil) click to toggle source
# 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