module Motion

Public Instance Methods

wiretap(target, property=nil, &block) click to toggle source
# File lib/motion-wiretap/ios/wiretap_factory.rb, line 5
def wiretap(target, property=nil, &block)
  case target
  when NSString
    MotionWiretap::WiretapNotification.new(target, property, block)
  when Proc
    MotionWiretap::WiretapProc.new(target, property, block)
  when NSArray
    MotionWiretap::WiretapArray.new(target, &block)
  when UIControl
    if property.nil?
      MotionWiretap::WiretapControl.new(target, &block)
    else
      MotionWiretap::WiretapKvo.new(target, property, &block)
    end
  when UIView
    if property.nil?
      MotionWiretap::WiretapView.new(target, &block)
    else
      MotionWiretap::WiretapKvo.new(target, property, &block)
    end
  else
    MotionWiretap::WiretapKvo.new(target, property, &block)
  end
end