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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 156d1749f66958660a03ad85d99369cd6c17f888
4
- data.tar.gz: 9769846b2b3863e6ab520a330c569209d60e78fe
2
+ SHA256:
3
+ metadata.gz: 25b4e127a2058c15e463d65dcdfeb37341f10a74ba932cd4e3e0c9cc26050de8
4
+ data.tar.gz: 49baea44dd5719e1dc98d02a3d29c593ea17d0c2e89d876c9e1562a472f9efe3
5
5
  SHA512:
6
- metadata.gz: 4771ff29c9b64c31b13e94d7a37c2fce246b49f146deffb3a43470e35687f70452f433ce1b92ab0b47c7088dfb627918a9050d83f0b2bcf6c53ee7471408bd21
7
- data.tar.gz: 3a84b96224b79f806982303bb7010fbcc62eaa1c29cf382452f45db38295f4c4b0958eaaa1605bdfeeb32fa8e399fa114f152541ad4d371d8e3578a170b5e3b9
6
+ metadata.gz: 5dc06b4e0088a7493ffa6141923f38edb2ffbcb37a888291bc670c47e3a4a509bc91be597de4d7941855758ff2afe7e938a99400c877ceeae7dc40fe00e771b9
7
+ data.tar.gz: 49396437f18d57fd907f55bd81c867b12f0d7046eb887aba25d720dc1cb1d40f8726b59246fa0ac61d2e2be5ce85f89485447ff7b695420d7653bca14ebc39d3
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "10:00"
8
+ open-pull-requests-limit: 10
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.3.1
4
- before_install: gem install bundler -v 1.10.5
4
+ before_install: gem install bundler
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
- * Don't assume 'date' and 'time' are already required by the time we require 'scheduled_value/timespan'
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
- * Bug fix: use setters in initializers so that custom conversions will work when deserializing ScheduledValues
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
- * `ScheduledValue::ScheduledValue#covers_all_time?` will no longer raise an exception if there are no timespans
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
- * Add `ScheduledValue::ScheduledValue#has_value_at?` method to reduce the need for exceptions-as-control-flow
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
- * Initial public release.
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
- attr_accessor :start, :finish
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
- "from #{start.to_s(format)}"
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
- "up to #{finish.to_s(format)}"
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
@@ -11,8 +11,12 @@ module ScheduledValue
11
11
  super.merge(value: value)
12
12
  end
13
13
 
14
- def to_s(format = nil)
14
+ def to_hash(*)
15
+ attributes
16
+ end
17
+
18
+ def to_s(format = nil, timezone = nil)
15
19
  "#{value} #{super}"
16
20
  end
17
21
  end
18
- end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module ScheduledValue
2
- VERSION = "1.1.3"
2
+ VERSION = '1.4.0'
3
3
  end
data/renovate.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ]
5
+ }
@@ -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.add_development_dependency "bundler", "~> 1.10"
23
- spec.add_development_dependency "rake", "~> 12.1"
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.1.3
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: 2017-09-27 00:00:00.000000000 Z
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: '1.10'
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: '1.10'
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: '12.1'
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: '12.1'
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
- rubyforge_project:
97
- rubygems_version: 2.6.4
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: []