describe_time 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/describe_time.rb +18 -3
  2. metadata +3 -3
data/lib/describe_time.rb CHANGED
@@ -1,5 +1,20 @@
1
- class DescribeTime
2
- def self.hi
3
- puts "First steps of my first gem"
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonatan Magnusson