scheduled_value 1.1.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +8 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +27 -5
- data/lib/scheduled_value/scheduled_value.rb +7 -1
- data/lib/scheduled_value/timespan.rb +13 -7
- data/lib/scheduled_value/timespan_with_value.rb +6 -2
- data/lib/scheduled_value/version.rb +1 -1
- data/renovate.json +5 -0
- data/scheduled_value.gemspec +4 -2
- metadata +26 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 25b4e127a2058c15e463d65dcdfeb37341f10a74ba932cd4e3e0c9cc26050de8
|
4
|
+
data.tar.gz: 49baea44dd5719e1dc98d02a3d29c593ea17d0c2e89d876c9e1562a472f9efe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dc06b4e0088a7493ffa6141923f38edb2ffbcb37a888291bc670c47e3a4a509bc91be597de4d7941855758ff2afe7e938a99400c877ceeae7dc40fe00e771b9
|
7
|
+
data.tar.gz: 49396437f18d57fd907f55bd81c867b12f0d7046eb887aba25d720dc1cb1d40f8726b59246fa0ac61d2e2be5ce85f89485447ff7b695420d7653bca14ebc39d3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,19 +1,41 @@
|
|
1
|
+
# 1.4.0 - September 19, 2021
|
2
|
+
|
3
|
+
- Use an explicit dependency on the sorted_set gem for Ruby 3 compatibility
|
4
|
+
|
5
|
+
# 1.3.0 - March 28, 2020
|
6
|
+
|
7
|
+
- Implement #to_hash as an alias for #attributes on all objects, to make ActiveSupport serialization
|
8
|
+
behave better
|
9
|
+
|
10
|
+
# 1.2.2 - January 17, 2019
|
11
|
+
|
12
|
+
- Fix a formatting bug where the start time could be accidentally used
|
13
|
+
as the finish time if there is no timezone
|
14
|
+
|
15
|
+
# 1.2.1 - January 25, 2018
|
16
|
+
|
17
|
+
- Fix a major bug when formatting timespans with timezones
|
18
|
+
|
19
|
+
# 1.2.0 - YANKED - January 25, 2018
|
20
|
+
|
21
|
+
- Allow passing timezone argument to string formatting methods in Timespan
|
22
|
+
|
1
23
|
# 1.1.3 - September 27, 2017
|
2
24
|
|
3
|
-
|
25
|
+
- Don't assume 'date' and 'time' are already required by the time we require 'scheduled_value/timespan'
|
4
26
|
|
5
27
|
# 1.1.2 - May 22, 2017
|
6
28
|
|
7
|
-
|
29
|
+
- Bug fix: use setters in initializers so that custom conversions will work when deserializing ScheduledValues
|
8
30
|
|
9
31
|
# 1.1.1 - February 18, 2017
|
10
32
|
|
11
|
-
|
33
|
+
- `ScheduledValue::ScheduledValue#covers_all_time?` will no longer raise an exception if there are no timespans
|
12
34
|
|
13
35
|
# 1.1.0 - December 25, 2016
|
14
36
|
|
15
|
-
|
37
|
+
- Add `ScheduledValue::ScheduledValue#has_value_at?` method to reduce the need for exceptions-as-control-flow
|
16
38
|
|
17
39
|
# 1.0.0 - December 24, 2016
|
18
40
|
|
19
|
-
|
41
|
+
- Initial public release.
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'sorted_set'
|
2
|
+
|
1
3
|
module ScheduledValue
|
2
4
|
class ScheduledValue
|
3
5
|
attr_reader :timespans
|
@@ -28,6 +30,10 @@ module ScheduledValue
|
|
28
30
|
}
|
29
31
|
end
|
30
32
|
|
33
|
+
def to_hash(*)
|
34
|
+
attributes
|
35
|
+
end
|
36
|
+
|
31
37
|
def attributes=(attributes)
|
32
38
|
self.timespans = attributes[:timespans] || attributes['timespans']
|
33
39
|
end
|
@@ -109,4 +115,4 @@ module ScheduledValue
|
|
109
115
|
timespans.find { |my_timespan| my_timespan.overlaps? timespan }
|
110
116
|
end
|
111
117
|
end
|
112
|
-
end
|
118
|
+
end
|
@@ -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
|
@@ -20,6 +20,10 @@ module ScheduledValue
|
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
+
def to_hash(*)
|
24
|
+
attributes
|
25
|
+
end
|
26
|
+
|
23
27
|
def start=(value)
|
24
28
|
@start = convert_time_value(value)
|
25
29
|
end
|
@@ -53,21 +57,23 @@ module ScheduledValue
|
|
53
57
|
"#<#{self.class.name}: #{self}>"
|
54
58
|
end
|
55
59
|
|
56
|
-
def to_s(format = nil)
|
57
|
-
"#{start_description(format)} #{finish_description(format)}"
|
60
|
+
def to_s(format = nil, timezone = nil)
|
61
|
+
"#{start_description(format, timezone)} #{finish_description(format, timezone)}"
|
58
62
|
end
|
59
63
|
|
60
|
-
def start_description(format = nil)
|
64
|
+
def start_description(format = nil, timezone = nil)
|
61
65
|
if start
|
62
|
-
|
66
|
+
start_in_zone = timezone ? start.in_time_zone(timezone) : start
|
67
|
+
"from #{start_in_zone.to_s(format)}"
|
63
68
|
else
|
64
69
|
'anytime'
|
65
70
|
end
|
66
71
|
end
|
67
72
|
|
68
|
-
def finish_description(format = nil)
|
73
|
+
def finish_description(format = nil, timezone = nil)
|
69
74
|
if finish
|
70
|
-
|
75
|
+
finish_in_zone = timezone ? finish.in_time_zone(timezone) : finish
|
76
|
+
"up to #{finish_in_zone.to_s(format)}"
|
71
77
|
elsif start
|
72
78
|
"indefinitely"
|
73
79
|
end
|
data/scheduled_value.gemspec
CHANGED
@@ -19,7 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.
|
23
|
-
|
22
|
+
spec.add_dependency "sorted_set", "~> 1.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
25
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
24
26
|
spec.add_development_dependency "minitest"
|
25
27
|
end
|
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scheduled_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Budin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sorted_set
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
33
|
+
version: '2.0'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
40
|
+
version: '2.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '13.0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '13.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,6 +74,7 @@ executables: []
|
|
60
74
|
extensions: []
|
61
75
|
extra_rdoc_files: []
|
62
76
|
files:
|
77
|
+
- ".github/dependabot.yml"
|
63
78
|
- ".gitignore"
|
64
79
|
- ".travis.yml"
|
65
80
|
- CHANGELOG.md
|
@@ -73,12 +88,13 @@ files:
|
|
73
88
|
- lib/scheduled_value/timespan.rb
|
74
89
|
- lib/scheduled_value/timespan_with_value.rb
|
75
90
|
- lib/scheduled_value/version.rb
|
91
|
+
- renovate.json
|
76
92
|
- scheduled_value.gemspec
|
77
93
|
homepage: https://github.com/neinteractiveliterature/scheduled_value
|
78
94
|
licenses:
|
79
95
|
- MIT
|
80
96
|
metadata: {}
|
81
|
-
post_install_message:
|
97
|
+
post_install_message:
|
82
98
|
rdoc_options: []
|
83
99
|
require_paths:
|
84
100
|
- lib
|
@@ -93,9 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
109
|
- !ruby/object:Gem::Version
|
94
110
|
version: '0'
|
95
111
|
requirements: []
|
96
|
-
|
97
|
-
|
98
|
-
signing_key:
|
112
|
+
rubygems_version: 3.2.22
|
113
|
+
signing_key:
|
99
114
|
specification_version: 4
|
100
115
|
summary: Ruby classes for values that change over time
|
101
116
|
test_files: []
|