scheduled_value 1.1.3 → 1.2.1
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 +5 -5
- data/CHANGELOG.md +8 -0
- data/lib/scheduled_value/timespan.rb +9 -7
- data/lib/scheduled_value/timespan_with_value.rb +2 -2
- data/lib/scheduled_value/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b81a491075b1bcacd3a7e3a4ccd0c1fbedb84467dd67fc0553705f0f2e90ecf2
|
4
|
+
data.tar.gz: fc2818b379dc616176f1dfb98ea7fa7a4c92b6651e59f73902554e89f0528f72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3735862668e754f7d7ca9f7619b298b22d5530df2179757c40bc4ed117249ec2c1979ec30674068ec212c06a2f7136fa8ab120dda85877497dc1e4f118feee6
|
7
|
+
data.tar.gz: 688e00b8e4d3c03ce6fcc6870f7c2ea855e384bf7ed82e0edae23c500b815ae393afc5aec12a4cdae3dc42faf0c2d0fca34f871ecd8d73291f118b793ea7b361
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 1.2.1 - January 25, 2018
|
2
|
+
|
3
|
+
* Fix a major bug when formatting timespans with timezones
|
4
|
+
|
5
|
+
# 1.2.0 - YANKED - January 25, 2018
|
6
|
+
|
7
|
+
* Allow passing timezone argument to string formatting methods in Timespan
|
8
|
+
|
1
9
|
# 1.1.3 - September 27, 2017
|
2
10
|
|
3
11
|
* Don't assume 'date' and 'time' are already required by the time we require 'scheduled_value/timespan'
|
@@ -4,7 +4,7 @@ require 'time'
|
|
4
4
|
module ScheduledValue
|
5
5
|
class Timespan
|
6
6
|
include Comparable
|
7
|
-
|
7
|
+
attr_reader :start, :finish
|
8
8
|
|
9
9
|
def initialize(start: nil, finish: nil)
|
10
10
|
self.start = start
|
@@ -53,21 +53,23 @@ module ScheduledValue
|
|
53
53
|
"#<#{self.class.name}: #{self}>"
|
54
54
|
end
|
55
55
|
|
56
|
-
def to_s(format = nil)
|
57
|
-
"#{start_description(format)} #{finish_description(format)}"
|
56
|
+
def to_s(format = nil, timezone = nil)
|
57
|
+
"#{start_description(format, timezone)} #{finish_description(format, timezone)}"
|
58
58
|
end
|
59
59
|
|
60
|
-
def start_description(format = nil)
|
60
|
+
def start_description(format = nil, timezone = nil)
|
61
61
|
if start
|
62
|
-
|
62
|
+
start_in_zone = timezone ? start.in_time_zone(timezone) : start
|
63
|
+
"from #{start_in_zone.to_s(format)}"
|
63
64
|
else
|
64
65
|
'anytime'
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
def finish_description(format = nil)
|
69
|
+
def finish_description(format = nil, timezone = nil)
|
69
70
|
if finish
|
70
|
-
|
71
|
+
finish_in_zone = timezone ? finish.in_time_zone(timezone) : start
|
72
|
+
"up to #{finish_in_zone.to_s(format)}"
|
71
73
|
elsif start
|
72
74
|
"indefinitely"
|
73
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scheduled_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Budin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.7.3
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Ruby classes for values that change over time
|