sugarcube 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (1.0.4)
4
+ sugarcube (1.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,8 +41,7 @@ class UIColor
41
41
  color = color.uicolor
42
42
 
43
43
  # make amount between 0 and 1
44
- amount = amount > 0 ? amount : 0
45
- amount = amount < 1 ? amount : 1
44
+ amount = [[0, amount].max, 1].min
46
45
  # start with precise amounts: 0, 0.5, and 1.
47
46
  if amount == 0 && self.alpha == color.alpha
48
47
  self
@@ -12,4 +12,7 @@ Motion::Project::App.setup do |app|
12
12
  Dir.glob(File.join(File.dirname(__FILE__), 'sugarcube-nsdate/**/*.rb')).reverse.each do |file|
13
13
  app.files.insert(insert_point, file)
14
14
  end
15
+
16
+ time = File.join(File.dirname(__FILE__), 'sugarcube-numbers/time.rb')
17
+ app.files.insert(insert_point, file)
15
18
  end
@@ -150,7 +150,7 @@ class NSDate
150
150
  # (main)> t.time_array
151
151
  # => [11, 29, 12]
152
152
  def time_array
153
- return [self.hour, self.send(:min), self.sec]
153
+ return [self.hour, self.min, self.sec]
154
154
  end
155
155
 
156
156
  # (main)> t = Time.new
@@ -158,7 +158,7 @@ class NSDate
158
158
  # (main)> t.time_array
159
159
  # => [2012, 9, 12, 11, 29, 12]
160
160
  def datetime_array
161
- return [self.year, self.month, self.day, self.hour, self.send(:min), self.sec]
161
+ return [self.year, self.month, self.day, self.hour, self.min, self.sec]
162
162
  end
163
163
 
164
164
  # (main)> t = Time.new
@@ -0,0 +1,81 @@
1
+ class Numeric
2
+
3
+ def milliseconds
4
+ self / 1000.0
5
+ end
6
+ alias millisecond milliseconds
7
+ alias millisecs milliseconds
8
+ alias millisec milliseconds
9
+
10
+ def in_milliseconds
11
+ self * 1000
12
+ end
13
+
14
+ def seconds
15
+ self
16
+ end
17
+ alias second seconds
18
+ alias sec seconds
19
+ alias secs seconds
20
+
21
+ def in_seconds
22
+ self
23
+ end
24
+
25
+ def minutes
26
+ self * 60
27
+ end
28
+ alias minute minutes
29
+ alias min minutes
30
+ alias mins minutes
31
+
32
+ def in_minutes
33
+ self / 1.minute.to_f
34
+ end
35
+
36
+ def hours
37
+ self * 3600
38
+ end
39
+ alias hour hours
40
+
41
+ def in_hours
42
+ self / 1.hour.to_f
43
+ end
44
+
45
+ def days
46
+ self.hours * 24
47
+ end
48
+ alias day days
49
+
50
+ def in_days
51
+ self / 1.day.to_f
52
+ end
53
+
54
+ def weeks
55
+ self.days * 7
56
+ end
57
+ alias week weeks
58
+
59
+ def in_weeks
60
+ self / 1.week.to_f
61
+ end
62
+
63
+ def months
64
+ self.days * 30
65
+ end
66
+ alias month months
67
+
68
+ def in_months
69
+ self / 1.month.to_f
70
+ end
71
+
72
+ def years
73
+ self.days * 365
74
+ end
75
+ alias year years
76
+
77
+ def in_years
78
+ self / 1.year.to_f
79
+ end
80
+
81
+ end
@@ -12,4 +12,7 @@ Motion::Project::App.setup do |app|
12
12
  Dir.glob(File.join(File.dirname(__FILE__), 'sugarcube-timer/**/*.rb')).reverse.each do |file|
13
13
  app.files.insert(insert_point, file)
14
14
  end
15
+
16
+ time = File.join(File.dirname(__FILE__), 'sugarcube-numbers/time.rb')
17
+ app.files.insert(insert_point, file)
15
18
  end
@@ -1,81 +1,4 @@
1
1
  class Numeric
2
- def milliseconds
3
- self / 1000.0
4
- end
5
- alias millisecond milliseconds
6
- alias millisecs milliseconds
7
- alias millisec milliseconds
8
-
9
- def in_milliseconds
10
- self * 1000
11
- end
12
-
13
- def seconds
14
- self
15
- end
16
- alias second seconds
17
- alias sec seconds
18
- alias secs seconds
19
-
20
- def in_seconds
21
- self
22
- end
23
-
24
- def minutes
25
- self * 60
26
- end
27
- alias minute minutes
28
- alias min minutes
29
- alias mins minutes
30
-
31
- def in_minutes
32
- self / 1.minute.to_f
33
- end
34
-
35
- def hours
36
- self * 3600
37
- end
38
- alias hour hours
39
-
40
- def in_hours
41
- self / 1.hour.to_f
42
- end
43
-
44
- def days
45
- self.hours * 24
46
- end
47
- alias day days
48
-
49
- def in_days
50
- self / 1.day.to_f
51
- end
52
-
53
- def weeks
54
- self.days * 7
55
- end
56
- alias week weeks
57
-
58
- def in_weeks
59
- self / 1.week.to_f
60
- end
61
-
62
- def months
63
- self.days * 30
64
- end
65
- alias month months
66
-
67
- def in_months
68
- self / 1.month.to_f
69
- end
70
-
71
- def years
72
- self.days * 365
73
- end
74
- alias year years
75
-
76
- def in_years
77
- self / 1.year.to_f
78
- end
79
2
 
80
3
  def later(user_info=nil, &fire)
81
4
  NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: false)
@@ -84,6 +7,7 @@ class Numeric
84
7
  def every(user_info=nil, &fire)
85
8
  NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: true)
86
9
  end
10
+
87
11
  end
88
12
 
89
13
 
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '1.0.4'
2
+ Version = '1.0.5'
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: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-08-02 00:00:00.000000000 Z
15
+ date: 2013-08-04 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: ! '== Description
18
18
 
@@ -142,6 +142,7 @@ files:
142
142
  - lib/sugarcube-numbers/fixnum.rb
143
143
  - lib/sugarcube-numbers/nsstring.rb
144
144
  - lib/sugarcube-numbers/numeric.rb
145
+ - lib/sugarcube-numbers/time.rb
145
146
  - lib/sugarcube-osx/adjust.rb
146
147
  - lib/sugarcube-pipes.rb
147
148
  - lib/sugarcube-pipes/pipes.rb