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-2.4.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.4.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.4.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.3.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.2.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.1.5 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.1.4 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.1.3 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.1.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.1.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.1.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.0.2 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.0.1 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-2.0.0 lib/cocoa/sugarcube-timer/timer.rb
sugarcube-1.7.0 lib/sugarcube-timer/timer.rb
sugarcube-1.6.3 lib/sugarcube-timer/timer.rb