Module: Motion

Defined in:
lib/motion-wiretap/ios/wiretap_factory.rb,
lib/motion-wiretap/osx/wiretap_factory.rb

Class Method Summary collapse

Class Method Details

.wiretap(target, property = nil, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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