stardate 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/stardate.rb +5 -5
- data/lib/stardate_interval.rb +12 -12
- metadata +3 -3
data/lib/stardate.rb
CHANGED
@@ -2,7 +2,7 @@ require 'time'
|
|
2
2
|
|
3
3
|
require 'stardate_interval'
|
4
4
|
|
5
|
-
class
|
5
|
+
class Stardate
|
6
6
|
|
7
7
|
attr_accessor :stardate
|
8
8
|
|
@@ -58,7 +58,7 @@ class StarDate
|
|
58
58
|
|
59
59
|
def initialize(t = Time.now)
|
60
60
|
case t.class.to_s
|
61
|
-
when "
|
61
|
+
when "Stardate"
|
62
62
|
@stardate = t.stardate
|
63
63
|
return
|
64
64
|
when "Fixnum"
|
@@ -85,7 +85,7 @@ class StarDate
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def -(arg)
|
88
|
-
|
88
|
+
StardateInterval.new arg, self
|
89
89
|
end
|
90
90
|
|
91
91
|
def inspect
|
@@ -153,7 +153,7 @@ end
|
|
153
153
|
class DateTime
|
154
154
|
|
155
155
|
def to_stardate
|
156
|
-
|
156
|
+
Stardate.new self
|
157
157
|
end
|
158
158
|
|
159
159
|
end
|
@@ -161,7 +161,7 @@ end
|
|
161
161
|
class Time
|
162
162
|
|
163
163
|
def to_stardate
|
164
|
-
|
164
|
+
Stardate.new self
|
165
165
|
end
|
166
166
|
|
167
167
|
end
|
data/lib/stardate_interval.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
class
|
1
|
+
class StardateInterval
|
2
2
|
|
3
3
|
attr_accessor :start, :stop
|
4
4
|
|
5
5
|
def initialize(start, stop)
|
6
|
-
@start =
|
7
|
-
@stop =
|
6
|
+
@start = Stardate.new start
|
7
|
+
@stop = Stardate.new stop
|
8
8
|
end
|
9
9
|
|
10
10
|
def -@
|
11
|
-
|
11
|
+
StardateInterval.new @stop, @start
|
12
12
|
end
|
13
13
|
|
14
14
|
def years
|
@@ -16,31 +16,31 @@ class StarDateInterval
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def months
|
19
|
-
years /
|
19
|
+
years / Stardate.month
|
20
20
|
end
|
21
21
|
|
22
22
|
def weeks
|
23
|
-
years /
|
23
|
+
years / Stardate.week
|
24
24
|
end
|
25
25
|
|
26
26
|
def days
|
27
|
-
years /
|
27
|
+
years / Stardate.day
|
28
28
|
end
|
29
29
|
|
30
30
|
def hours
|
31
|
-
years /
|
31
|
+
years / Stardate.hour
|
32
32
|
end
|
33
33
|
|
34
34
|
def minutes
|
35
|
-
years /
|
35
|
+
years / Stardate.minute
|
36
36
|
end
|
37
37
|
|
38
38
|
def seconds
|
39
|
-
years /
|
39
|
+
years / Stardate.second
|
40
40
|
end
|
41
41
|
|
42
42
|
def milliseconds
|
43
|
-
years /
|
43
|
+
years / Stardate.millisecond
|
44
44
|
end
|
45
45
|
|
46
46
|
def inspect
|
@@ -63,4 +63,4 @@ class StarDateInterval
|
|
63
63
|
return "%.#{precision}e seconds" % seconds
|
64
64
|
end
|
65
65
|
|
66
|
-
end
|
66
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stardate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
14
|
+
description: Stardate representation
|
15
15
|
email: zlkm208-rubygems@yahoo.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -42,5 +42,5 @@ rubyforge_project:
|
|
42
42
|
rubygems_version: 1.8.24
|
43
43
|
signing_key:
|
44
44
|
specification_version: 3
|
45
|
-
summary:
|
45
|
+
summary: Stardate representation
|
46
46
|
test_files: []
|