iso8601 0.9.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ddae589523a353d89540217174b6d9ee8806be0
4
- data.tar.gz: e0194acdcdc97a76bfa05ef1cf0389e01ab39d10
3
+ metadata.gz: 7914ac8d5219dd6b3fe4628c4d7ad8f152e8e2c6
4
+ data.tar.gz: 2cbee2da317086254dc93762a8513d20b7e68c0e
5
5
  SHA512:
6
- metadata.gz: d013dd70e31518034388484c891a4b407d475bafb178b762fc997a9927ac43a90cde015ac0cf308a1d713d3dc4a1cb1ee0d333e8f0e31cf93e2c0c75a859ec81
7
- data.tar.gz: 6144023256e448874c926377449230a059145996d48ab355d04acba4f22d2bd497a8a11892a43bf46c76d10cd3775d9661ce41f6aa101d19938216d307ce54bb
6
+ metadata.gz: 6a32d6585c8d0a226317237e2741ba15a7bc156a727ce4e73c04d04bcc85f987bfb1f6f6a29b40508de57ee4dbe96ad6b036306449479a3c19a4ba947cf2d88e
7
+ data.tar.gz: fb5653793de6ec27dc4ef8acef0364ad9744fc3770cf0606f4071b07cd4057afb3aa41c9d478bf588527cbda0bde82dddc7a2d072885678680becac6b537a339
@@ -1,3 +1,7 @@
1
+ ## 0.9.1
2
+
3
+ * Fix `Duration#to_pattern` for negative durations based on a `Numeric` (thanks @figwit).
4
+
1
5
  ## 0.9.0
2
6
 
3
7
  This version is **not compatible** with previous versions. Atoms and Durations
data/Gemfile CHANGED
@@ -1,8 +1,3 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- group :development do
6
- gem 'pry', '~> 0.10.3'
7
- gem 'pry-doc', '~> 0.8.0'
8
- end
@@ -18,15 +18,14 @@ PnW
18
18
 
19
19
  ## Usage
20
20
 
21
- Some times using durations might be more convenient than using time intervals
22
- (e.g. you don't need or want a specific point in time).
21
+ Some times using durations might be more convenient than using time intervals:
23
22
 
24
23
  ```ruby
25
24
  duration = ISO8601::Duration.new('PT10H')
26
25
  duration.to_seconds # => 36000.0
27
26
  ```
28
27
 
29
- Although you reuse the duration with a time interval:
28
+ You can reuse the duration with a time interval:
30
29
 
31
30
  ```ruby
32
31
  start_time = ISO8601::DateTime.new('2015-01-01T10:11:12Z')
@@ -45,7 +44,7 @@ duration.to_seconds(base) # => 36000.0
45
44
  ```
46
45
 
47
46
  **Warning**: When using durations without base, the result of `#to_seconds` is
48
- an _average_. See the implementation of the atoms for details.
47
+ an _average_. See the atoms' implementation for details.
49
48
 
50
49
 
51
50
  # Operate with durations
@@ -63,5 +63,7 @@ Gem::Specification.new do |s|
63
63
  s.has_rdoc = 'yard'
64
64
  s.required_ruby_version = '>= 2.0.0'
65
65
  s.add_development_dependency 'rspec', '~> 3.4'
66
- s.add_development_dependency 'rubocop', '~> 0.35'
66
+ s.add_development_dependency 'rubocop', '~> 0.40'
67
+ s.add_development_dependency 'pry', '~> 0.10.3'
68
+ s.add_development_dependency 'pry-doc', '~> 0.8.0'
67
69
  end
@@ -145,7 +145,11 @@ module ISO8601
145
145
  #
146
146
  # @return [String]
147
147
  def to_pattern(original)
148
- (original.is_a? Numeric) ? "PT#{original}S" : original
148
+ if original.is_a? Numeric
149
+ "#{original < 0 ? '-' : ''}PT#{original.abs}S"
150
+ else
151
+ original
152
+ end
149
153
  end
150
154
 
151
155
  ##
@@ -1,5 +1,5 @@
1
1
  module ISO8601
2
2
  ##
3
3
  # The gem version
4
- VERSION = '0.9.0'
4
+ VERSION = '0.9.1'
5
5
  end
@@ -61,6 +61,7 @@ RSpec.describe ISO8601::Duration do
61
61
  it "should return the duration pattern" do
62
62
  expect(ISO8601::Duration.new('P1Y1M1DT1H1M1S').pattern).to eq('P1Y1M1DT1H1M1S')
63
63
  expect(ISO8601::Duration.new(60).pattern).to eq('PT60S')
64
+ expect(ISO8601::Duration.new(-60).pattern).to eq('-PT60S')
64
65
  end
65
66
  end
66
67
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso8601
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnau Siches
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-13 00:00:00.000000000 Z
11
+ date: 2016-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -30,14 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.35'
33
+ version: '0.40'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.35'
40
+ version: '0.40'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-doc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.0
41
69
  description: |2
42
70
  ISO8601 is a simple implementation in Ruby of the ISO 8601 (Data elements and
43
71
  interchange formats - Information interchange - Representation of dates
@@ -106,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
134
  version: '0'
107
135
  requirements: []
108
136
  rubyforge_project: iso8601
109
- rubygems_version: 2.5.0
137
+ rubygems_version: 2.6.4
110
138
  signing_key:
111
139
  specification_version: 4
112
140
  summary: Ruby parser to work with ISO 8601 dateTimes and durations - http://en.wikipedia.org/wiki/ISO_8601