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.3.11 lib/sugarcube-timer/timer.rb
sugarcube-1.3.10 lib/sugarcube-timer/timer.rb
sugarcube-1.3.9 lib/sugarcube-timer/timer.rb
sugarcube-1.3.8 lib/sugarcube-timer/timer.rb
sugarcube-1.3.7 lib/sugarcube-timer/timer.rb
sugarcube-1.3.6 lib/sugarcube-timer/timer.rb
sugarcube-1.3.5 lib/sugarcube-timer/timer.rb
sugarcube-1.3.4 lib/sugarcube-timer/timer.rb
sugarcube-1.3.3 lib/sugarcube-timer/timer.rb
sugarcube-1.3.2 lib/sugarcube-timer/timer.rb
sugarcube-1.3.1 lib/sugarcube-timer/timer.rb
sugarcube-1.3.0 lib/sugarcube-timer/timer.rb
sugarcube-1.1.0 lib/sugarcube-timer/timer.rb
sugarcube-1.0.7 lib/sugarcube-timer/timer.rb
sugarcube-1.0.6 lib/sugarcube-timer/timer.rb
sugarcube-1.0.5 lib/sugarcube-timer/timer.rb