describe_time 0.0.1 → 0.0.2
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/describe_time.rb +18 -3
- metadata +3 -3
data/lib/describe_time.rb
CHANGED
@@ -1,5 +1,20 @@
|
|
1
|
-
|
2
|
-
def self.
|
3
|
-
|
1
|
+
module DescribeTime
|
2
|
+
def self.describe_time(the_time = Time.now, current_time = Time.now)
|
3
|
+
if current_time - the_time < 0
|
4
|
+
puts "Time in the future"
|
5
|
+
else
|
6
|
+
if current_time - the_time < 5
|
7
|
+
puts "Seconds ago"
|
8
|
+
else
|
9
|
+
puts the_time
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Time
|
16
|
+
def describe
|
17
|
+
DescribeTime.describe_time(self, Time.now)
|
18
|
+
puts "no chance"
|
4
19
|
end
|
5
20
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: describe_time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonatan Magnusson
|