scheduled_value 1.1.3 → 1.2.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
- SHA1:
3
- metadata.gz: 156d1749f66958660a03ad85d99369cd6c17f888
4
- data.tar.gz: 9769846b2b3863e6ab520a330c569209d60e78fe
2
+ SHA256:
3
+ metadata.gz: b81a491075b1bcacd3a7e3a4ccd0c1fbedb84467dd67fc0553705f0f2e90ecf2
4
+ data.tar.gz: fc2818b379dc616176f1dfb98ea7fa7a4c92b6651e59f73902554e89f0528f72
5
5
  SHA512:
6
- metadata.gz: 4771ff29c9b64c31b13e94d7a37c2fce246b49f146deffb3a43470e35687f70452f433ce1b92ab0b47c7088dfb627918a9050d83f0b2bcf6c53ee7471408bd21
7
- data.tar.gz: 3a84b96224b79f806982303bb7010fbcc62eaa1c29cf382452f45db38295f4c4b0958eaaa1605bdfeeb32fa8e399fa114f152541ad4d371d8e3578a170b5e3b9
6
+ metadata.gz: a3735862668e754f7d7ca9f7619b298b22d5530df2179757c40bc4ed117249ec2c1979ec30674068ec212c06a2f7136fa8ab120dda85877497dc1e4f118feee6
7
+ data.tar.gz: 688e00b8e4d3c03ce6fcc6870f7c2ea855e384bf7ed82e0edae23c500b815ae393afc5aec12a4cdae3dc42faf0c2d0fca34f871ecd8d73291f118b793ea7b361
@@ -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
- attr_accessor :start, :finish
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
- "from #{start.to_s(format)}"
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
- "up to #{finish.to_s(format)}"
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
@@ -11,8 +11,8 @@ module ScheduledValue
11
11
  super.merge(value: value)
12
12
  end
13
13
 
14
- def to_s(format = nil)
14
+ def to_s(format = nil, timezone = nil)
15
15
  "#{value} #{super}"
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module ScheduledValue
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2.1"
3
3
  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.3
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: 2017-09-27 00:00:00.000000000 Z
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.6.4
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