ozone 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ozone/version.rb +1 -1
  3. data/lib/ozone.rb +15 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6333a6bb89f133a43dcf273dd82f5d7a2de819e6
4
- data.tar.gz: 8eeeb170d91b60cc8a6dd40fb580b2469d46f99f
3
+ metadata.gz: 0c585fbf22c931b863f9fddcdf007c5ae2fc4f92
4
+ data.tar.gz: fe8603a322ab57aa36896ee45a5575bebee510b0
5
5
  SHA512:
6
- metadata.gz: 2a45fc5be2db9076de08bfc80249dd2daa966cdb65baa6f9b802b36b14e1849a8cdefc07609c7c80855f050238d1c0e98474a5f7fcc2e10e5e1d09fedaea63e8
7
- data.tar.gz: 547347a2b563f3191a643f9de83c734f4e6560e15a47ee9da2ecaa827d195998ed22c4b7a643d132c857fa038680eba07a1e806f4a826d5b9f72580ca7595088
6
+ metadata.gz: 9ee36d054417a3cbc4f9a79e3b746d64739933bdb6c3b36fd8e592f2572c01ec20162bba2513acacb5f75ce89833d973cfe20d24affca7598af9f4450395c826
7
+ data.tar.gz: b205d566b1da27dcb1bc3df74511af671bee64c63e174371f1e0f5be64b1ef6e2c123e54a65d973810bee9454752a26be0339216fa51734cacc32ccd69a440de
data/lib/ozone/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ozone
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/ozone.rb CHANGED
@@ -36,18 +36,32 @@ module Ozone
36
36
  @time = time
37
37
  end
38
38
 
39
+ def <=> (time_with_zone)
40
+ if after?(time_with_zone)
41
+ 1
42
+ elsif before?(time_with_zone)
43
+ -1
44
+ else
45
+ 0
46
+ end
47
+ end
48
+
39
49
  def before?(time_with_zone)
40
50
  adjusted_time < time_with_zone
41
51
  end
42
52
 
43
53
  def after?(time_with_zone)
44
- !before?(time_with_zone)
54
+ adjusted_time > time_with_zone
45
55
  end
46
56
 
47
57
  def strftime(format: '%Y-%m-%d %H:%M')
48
58
  Formatter.call(time: @time, offset: @offset, observes_dst: @observes_dst, format: format)
49
59
  end
50
60
 
61
+ alias_method :<, :before?
62
+ alias_method :>, :after?
63
+ alias_method :to_s, :strftime
64
+
51
65
  private
52
66
 
53
67
  def adjusted_time
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ozone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hubert Huang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport