sugarcube 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -326,6 +326,18 @@ end
326
326
  1.second.every do
327
327
  @view.shake
328
328
  end
329
+
330
+ # other time-related methods
331
+ 1.second || 2.seconds
332
+ 1.minute || 2.minutes # 60 seconds
333
+ 1.hour || 2.hours # 60 minutes
334
+ 1.day || 2.days # 24 hours
335
+ 1.week || 2.weeks # 7 days
336
+ # with sensible values for 'month' and 'year', even though we all know you can't
337
+ # **really** define them this way (go back to python if you find your brain
338
+ # hemorrhaging):
339
+ 1.month || 2.months # 30 days
340
+ 1.year || 2.years # 365 days
329
341
  ```
330
342
 
331
343
  NSUserDefaults
@@ -19,6 +19,26 @@ class Numeric
19
19
  end
20
20
  alias :hour :hours
21
21
 
22
+ def days
23
+ self.hours * 24
24
+ end
25
+ alias :day :days
26
+
27
+ def weeks
28
+ self.days * 7
29
+ end
30
+ alias :week :weeks
31
+
32
+ def months
33
+ self.days * 30
34
+ end
35
+ alias :month :months
36
+
37
+ def years
38
+ self.days * 365
39
+ end
40
+ alias :year :years
41
+
22
42
  def later(user_info=nil, &fire)
23
43
  NSTimer.scheduledTimerWithTimeInterval(self.to_f, target: fire, selector: 'call:', userInfo: user_info, repeats: false)
24
44
  end
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.7.1'
2
+ Version = '0.7.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: