to_timezone 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +19 -1
- data/Rakefile +3 -3
- data/lib/to_timezone/tz_ext.rb +9 -8
- data/lib/to_timezone/version.rb +1 -1
- data/lib/to_timezone.rb +2 -2
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce7a7bdd54ede5840cab4ba15cb9053edd65593a3fc201d01c3f68299cf789f9
|
4
|
+
data.tar.gz: 489e4184cdfe88291004d7fc6ab1426214b8a3b477f6f273d25d698dc9d28967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77504136e3e7d7b16aa116692d27a370d399a29650682a9fb335e038ee2cb00b142a192d8b5aceede385d1e7cceed12e2ac8db6cfbbe1bc5a75512b0d1303608
|
7
|
+
data.tar.gz: b8e83de1f21d4c4846715dbbd186f0c9ee6cbda04e59be54e1725e51652ef3560dda2149e0633bd1ac04eecb18a52869be36b393f61526d3915488c4d6b75222
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,25 @@ AllCops:
|
|
2
2
|
TargetRubyVersion: 3.1
|
3
3
|
|
4
4
|
Style/StringLiterals:
|
5
|
-
EnforcedStyle:
|
5
|
+
EnforcedStyle: single_quotes
|
6
6
|
|
7
7
|
Style/StringLiteralsInInterpolation:
|
8
8
|
EnforcedStyle: double_quotes
|
9
|
+
|
10
|
+
Layout/LineLength:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Naming/VariableNumber:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Gemspec/RequiredRubyVersion:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/ClassAndModuleChildren:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/Documentation:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/ClassLength:
|
26
|
+
Enabled: false
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
data/lib/to_timezone/tz_ext.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require_relative 'tzs'
|
4
|
+
require 'active_support'
|
5
|
+
require 'active_support/core_ext/time'
|
6
|
+
require 'active_support/core_ext/string/zones'
|
6
7
|
|
7
8
|
module ToTimezone
|
8
9
|
module TzExt
|
9
10
|
ToTimezone::Tzs::TIMEZONES.each do |abbr, timezone|
|
10
11
|
define_method("to_#{abbr}") do
|
11
|
-
|
12
|
+
if is_a?(DateTime)
|
13
|
+
to_time.in_time_zone(timezone)
|
14
|
+
else
|
15
|
+
in_time_zone(timezone)
|
16
|
+
end
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
@@ -25,10 +30,6 @@ end
|
|
25
30
|
|
26
31
|
class String
|
27
32
|
include ToTimezone::TzExt
|
28
|
-
|
29
|
-
def utc
|
30
|
-
in_time_zone("UTC")
|
31
|
-
end
|
32
33
|
end
|
33
34
|
|
34
35
|
# Explicitly patch ActiveSupport::TimeWithZone
|
data/lib/to_timezone/version.rb
CHANGED
data/lib/to_timezone.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_timezone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nujian Den Mark Meralpis
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -37,20 +37,6 @@ dependencies:
|
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: timecop
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
type: :development
|
48
|
-
prerelease: false
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
40
|
description: Adds intuitive time zone conversion methods to Time and DateTime in Rails,
|
55
41
|
allowing calls like `.to_pht`, `.to_ict`, and more for effortless time zone handling.
|
56
42
|
email:
|
@@ -93,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
79
|
- !ruby/object:Gem::Version
|
94
80
|
version: '0'
|
95
81
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
82
|
+
rubygems_version: 3.7.1
|
97
83
|
specification_version: 4
|
98
84
|
summary: Seamlessly convert Time and DateTime objects to different time zones with
|
99
85
|
intuitive methods like `.to_pht`, `.to_ict`, and more.
|