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-4.0.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.5.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.4.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.4.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.4.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.7 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.6 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.5 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.4 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.3 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.3.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.2.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.1.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.1.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.8 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.7 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.6 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-3.0.5 lib/cocoa/sugarcube-timer/timer.rb