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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -5
- data/docs/duration.md +3 -4
- data/iso8601.gemspec +3 -1
- data/lib/iso8601/duration.rb +5 -1
- data/lib/iso8601/version.rb +1 -1
- data/spec/iso8601/duration_spec.rb +1 -0
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7914ac8d5219dd6b3fe4628c4d7ad8f152e8e2c6
|
4
|
+
data.tar.gz: 2cbee2da317086254dc93762a8513d20b7e68c0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a32d6585c8d0a226317237e2741ba15a7bc156a727ce4e73c04d04bcc85f987bfb1f6f6a29b40508de57ee4dbe96ad6b036306449479a3c19a4ba947cf2d88e
|
7
|
+
data.tar.gz: fb5653793de6ec27dc4ef8acef0364ad9744fc3770cf0606f4071b07cd4057afb3aa41c9d478bf588527cbda0bde82dddc7a2d072885678680becac6b537a339
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/docs/duration.md
CHANGED
@@ -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
|
-
|
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
|
47
|
+
an _average_. See the atoms' implementation for details.
|
49
48
|
|
50
49
|
|
51
50
|
# Operate with durations
|
data/iso8601.gemspec
CHANGED
@@ -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.
|
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
|
data/lib/iso8601/duration.rb
CHANGED
@@ -145,7 +145,11 @@ module ISO8601
|
|
145
145
|
#
|
146
146
|
# @return [String]
|
147
147
|
def to_pattern(original)
|
148
|
-
|
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
|
##
|
data/lib/iso8601/version.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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.
|
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.
|
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
|