quarter 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/quarter/yaml.rb +29 -0
- data/quarter.gemspec +3 -2
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec19889b55f7693482a78ca92e13d9dc143a52dd22c7d1c97752343b95d3f70
|
4
|
+
data.tar.gz: 533c16ac28a0d94cc0f45cc760005661ab6f9c81edeec68195e277662103d6ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca11ce100186dc98c1274293fe883009b17273100047a64f678a33099c93b04d50dcd7d34150ab848816f72b6f77dd82194a5320e74c4e889fe4cdc7819dd7d
|
7
|
+
data.tar.gz: 85ac644ab0b7a8dea6d416adca67cc97e80f894b6e82a601ebb8b7dfed4522084cca3525de00a12007a1bd463e3a32f25427d72457d930e0556cdd881804360b
|
data/README.md
CHANGED
data/lib/quarter/yaml.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Quarter
|
4
|
+
def encode_with(coder)
|
5
|
+
coder.represent_scalar(nil, to_s)
|
6
|
+
end
|
7
|
+
|
8
|
+
module ScalarScannerPatch
|
9
|
+
QUARTER_AND_YEAR = /\AQ(\d) ?(\d{4})\z/
|
10
|
+
|
11
|
+
YEAR_AND_QUARTER = /\A(\d{4})[\-\/]?Q(\d)\z/
|
12
|
+
|
13
|
+
def tokenize(string)
|
14
|
+
if !string.empty? && string.match(QUARTER_AND_YEAR)
|
15
|
+
return Quarter.new($2.to_i, $1.to_i)
|
16
|
+
end
|
17
|
+
|
18
|
+
if !string.empty? && string.match(YEAR_AND_QUARTER)
|
19
|
+
return Quarter.new($1.to_i, $2.to_i)
|
20
|
+
end
|
21
|
+
|
22
|
+
super string
|
23
|
+
end
|
24
|
+
|
25
|
+
YAML::ScalarScanner.prepend(self)
|
26
|
+
end
|
27
|
+
|
28
|
+
private_constant :ScalarScannerPatch
|
29
|
+
end
|
data/quarter.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'quarter'
|
3
|
-
s.version = '1.
|
3
|
+
s.version = '1.1.0'
|
4
4
|
s.license = 'LGPL-3.0'
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.authors = ['Tim Craft']
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.metadata = {
|
14
14
|
'homepage' => 'https://github.com/readysteady/quarter',
|
15
15
|
'source_code_uri' => 'https://github.com/readysteady/quarter',
|
16
|
-
'bug_tracker_uri' => 'https://github.com/readysteady/quarter/issues'
|
16
|
+
'bug_tracker_uri' => 'https://github.com/readysteady/quarter/issues',
|
17
|
+
'changelog_uri' => 'https://github.com/readysteady/quarter/blob/master/CHANGES.md'
|
17
18
|
}
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quarter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Craft
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby gem for working with standard calendar quarters
|
14
14
|
email:
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- LICENSE.txt
|
21
21
|
- README.md
|
22
22
|
- lib/quarter.rb
|
23
|
+
- lib/quarter/yaml.rb
|
23
24
|
- quarter.gemspec
|
24
25
|
homepage: https://github.com/readysteady/quarter
|
25
26
|
licenses:
|
@@ -28,7 +29,8 @@ metadata:
|
|
28
29
|
homepage: https://github.com/readysteady/quarter
|
29
30
|
source_code_uri: https://github.com/readysteady/quarter
|
30
31
|
bug_tracker_uri: https://github.com/readysteady/quarter/issues
|
31
|
-
|
32
|
+
changelog_uri: https://github.com/readysteady/quarter/blob/master/CHANGES.md
|
33
|
+
post_install_message:
|
32
34
|
rdoc_options: []
|
33
35
|
require_paths:
|
34
36
|
- lib
|
@@ -44,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
46
|
version: '0'
|
45
47
|
requirements: []
|
46
48
|
rubygems_version: 3.1.2
|
47
|
-
signing_key:
|
49
|
+
signing_key:
|
48
50
|
specification_version: 4
|
49
51
|
summary: See description
|
50
52
|
test_files: []
|