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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee89de1f0184f1a1c816f6da0f81544b04c1700325dbdfe018cedb709a73eb68
4
- data.tar.gz: f5728f54665347af3b15b6396121f8667ba01488af85bccbedc62c707f67fa41
3
+ metadata.gz: 0ec19889b55f7693482a78ca92e13d9dc143a52dd22c7d1c97752343b95d3f70
4
+ data.tar.gz: 533c16ac28a0d94cc0f45cc760005661ab6f9c81edeec68195e277662103d6ba
5
5
  SHA512:
6
- metadata.gz: 30c126a64d3ae114d3d244722f1f32453a96782f4d6ebf4ee264087818c7b5bca5b4619bf8b7775a9fc9b12158a0d5ec4b8a1382bdf192a0f15a80b67027a23c
7
- data.tar.gz: 1bc3ff80ba433d9a21982d1a5b1da2183505363bb4dc98a48c3940ef5a9edb0510e9aa4ede503e94a4989688de3a742055280ab5d4056a832d84bc0b28eab2e6
6
+ metadata.gz: 1ca11ce100186dc98c1274293fe883009b17273100047a64f678a33099c93b04d50dcd7d34150ab848816f72b6f77dd82194a5320e74c4e889fe4cdc7819dd7d
7
+ data.tar.gz: 85ac644ab0b7a8dea6d416adca67cc97e80f894b6e82a601ebb8b7dfed4522084cca3525de00a12007a1bd463e3a32f25427d72457d930e0556cdd881804360b
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # percentage
1
+ # quarter
2
+
3
+ ![Gem Version](https://badge.fury.io/rb/quarter.svg)
4
+ ![Build Status](https://github.com/readysteady/quarter/workflows/Test/badge.svg)
5
+
2
6
 
3
7
  Ruby gem for working with standard calendar quarters.
4
8
 
@@ -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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'quarter'
3
- s.version = '1.0.0'
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.0.0
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-04-27 00:00:00.000000000 Z
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
- post_install_message:
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: []