Sha256: 349b7ffb04a4083561afd7ec2117811d650564592c502c5cf5c0f3c7aaa748be

Contents?: true

Size: 759 Bytes

Versions: 36

Compression:

Stored size: 759 Bytes

Contents

class Numeric

  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

36 entries across 36 versions & 1 rubygems

Version Path
sugarcube-1.6.2 lib/sugarcube-timer/timer.rb
sugarcube-1.6.1 lib/sugarcube-timer/timer.rb
sugarcube-1.6.0 lib/sugarcube-timer/timer.rb
sugarcube-1.5.9 lib/sugarcube-timer/timer.rb
sugarcube-1.5.8 lib/sugarcube-timer/timer.rb
sugarcube-1.5.7 lib/sugarcube-timer/timer.rb
sugarcube-1.5.6 lib/sugarcube-timer/timer.rb
sugarcube-1.5.5 lib/sugarcube-timer/timer.rb
sugarcube-1.5.4 lib/sugarcube-timer/timer.rb
sugarcube-1.5.3 lib/sugarcube-timer/timer.rb
sugarcube-1.5.2 lib/sugarcube-timer/timer.rb
sugarcube-1.5.1 lib/sugarcube-timer/timer.rb
sugarcube-1.5.0 lib/sugarcube-timer/timer.rb
sugarcube-1.4.6 lib/sugarcube-timer/timer.rb
sugarcube-1.4.5 lib/sugarcube-timer/timer.rb
sugarcube-1.4.4 lib/sugarcube-timer/timer.rb
sugarcube-1.4.3 lib/sugarcube-timer/timer.rb
sugarcube-1.4.2 lib/sugarcube-timer/timer.rb
sugarcube-1.4.1 lib/sugarcube-timer/timer.rb
sugarcube-1.4.0 lib/sugarcube-timer/timer.rb