dtg 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f366bb0470f56abd6358a4b0c01545401fa370fb57b12877187f1b30e34ce2f
4
- data.tar.gz: 76df55ea4b078f16e2b1dbb608af0ab14b93dab9f2a2a3be1f76e66ff6dc37e6
3
+ metadata.gz: 23d56074244f86fd246714de4f7827abfce02be31de2bc93e659311b9e08404a
4
+ data.tar.gz: d83417f20621befc87d12f8a26d165b655fc23192a05d3aa938ae81cf39cb816
5
5
  SHA512:
6
- metadata.gz: 87232c8fc667bccc35f53ef04be862ab8cb8ccb6d092812d089f58fe37acc50764c3054dbd278f9cdb5ec89219220726bf893a374aba32cd17e0960aab11445a
7
- data.tar.gz: fd2f67556bf33150968bcb2a06078e2488cc93cf840db5e545491d8e376960f9d53db8dc5b8a0d3f48c6d6b8eec3fc87a879860cd3f3e85f05e7a2126e54e750
6
+ metadata.gz: e11bf743407ad275537cfd943e02e5aa280179a7524f059274260d58a91b42f41f7706c4816d4e03f54eab6487732381fec7cf621bfff639e0f53cc27097af2b
7
+ data.tar.gz: 97a53b9db182dfed337c9a996787934e9b6d634307717dae460ef2eb81117bef0a1e7024faa21b2ea48aecc4a7bc5f160f6b93df68a6b3d4feb20f5c56d30d02
data/lib/dtg.rb CHANGED
@@ -5,7 +5,31 @@ require "dtg/time_ext"
5
5
  require "dtg/active_support/time_with_zone_ext"
6
6
 
7
7
  module Dtg
8
+ # Zones module has timezones (UTC_Zones) as dtg listings
9
+ include Zones
10
+
11
+ # DTG Test to determine if was injected properly into class
8
12
  def dtg
9
13
  "DTG gem is natively integrated with this class: #{self.class}"
10
14
  end
15
+
16
+ # Convert the object to the proper zone and then format as dtg in zone
17
+ def to_dtg(zone = :z)
18
+ convert(zone).format(zone)
19
+ end
20
+
21
+ # Format the object into specified zone (as dtg)
22
+ def format(zone = :z)
23
+ key = zone.downcase.to_sym
24
+ raise "Error: #{zone} is not a valid zone" unless UTC_ZONES.key?(key)
25
+ dtg = "%d%H%M#{key.upcase.to_s} %b %y"
26
+ strftime(dtg)
27
+ end
28
+
29
+ # Convert the object into the proper zone specified
30
+ def convert(zone = :z)
31
+ key = zone.downcase.to_sym
32
+ raise "Error: #{zone} is not a valid zone" unless UTC_ZONES.key?(key)
33
+ key == :j ? self.dup : self.in_time_zone(UTC_ZONES[key])
34
+ end
11
35
  end
@@ -1,24 +1,5 @@
1
1
  require 'dtg'
2
- require_relative '../zones'
3
2
 
4
3
  class ActiveSupport::TimeWithZone
5
4
  include Dtg
6
- include Zones
7
-
8
- def to_dtg(zone = :z)
9
- convert(zone).format(zone)
10
- end
11
-
12
- def format(zone = :z)
13
- key = zone.downcase.to_sym
14
- raise "Error: #{zone} is not a valid zone" unless UTC_ZONES.key?(key)
15
- dtg = "%d%H%M#{key.upcase.to_s} %b %y"
16
- strftime(dtg)
17
- end
18
-
19
- def convert(zone = :z)
20
- key = zone.downcase.to_sym
21
- raise "Error: #{zone} is not a valid zone" unless UTC_ZONES.key?(key)
22
- key == :j ? self.dup : self.in_time_zone(UTC_ZONES[key])
23
- end
24
5
  end
@@ -1,24 +1,5 @@
1
1
  require 'dtg'
2
- require_relative 'zones'
3
2
 
4
3
  class Time
5
4
  include Dtg
6
- include Zones
7
-
8
- def to_dtg(zone = :z)
9
- convert(zone).format(zone)
10
- end
11
-
12
- def format(zone = :z)
13
- key = zone.downcase.to_sym
14
- raise "Error: #{zone} is not a valid zone" unless UTC_ZONES.key?(key)
15
- dtg = "%d%H%M#{key.upcase.to_s} %b %y"
16
- strftime(dtg)
17
- end
18
-
19
- def convert(zone = :z)
20
- key = zone.downcase.to_sym
21
- raise "Error: #{zone} is not a valid zone" unless UTC_ZONES.key?(key)
22
- key == :j ? self.dup : self.in_time_zone(UTC_ZONES[key])
23
- end
24
5
  end
@@ -1,3 +1,3 @@
1
1
  module Dtg
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtg
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SolarisFlare
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-19 00:00:00.000000000 Z
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails