Sha256: 16873655c18358123b046463945dd5922c040decf9fa694ddadd4fbaed76aac7

Contents?: true

Size: 760 Bytes

Versions: 56

Compression:

Stored size: 760 Bytes

Contents

class NSNumber

  def later(user_info=nil, &fire)
    NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: false)
  end

  def every(user_info=nil, &fire)
    NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: true)
  end

end


module SugarCube
  module Timer
    module_function

    def every(time, user_info=nil, &fire)
      time.every user_info, &fire
    end

    def after(time, user_info=nil, &fire)
      time.later user_info, &fire
    end
  end
end


class NSTimer
  def self.every(time, user_info=nil, &fire)
    time.every user_info, &fire
  end

  def self.after(time, user_info=nil, &fire)
    time.later user_info, &fire
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
sugarcube-3.0.4 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.3 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.12.3 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.12.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.12.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.12.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.11.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.11.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.10.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.9.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.8.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.8.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.8.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.7.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.7.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.6.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.5.0 lib/cocoa/sugarcube-timer/timer.rb