month 1.6.0 → 1.7.0

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -2
  3. data/lib/month/yaml.rb +23 -0
  4. data/month.gemspec +2 -2
  5. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a6feb44a5e36d189f65a6a36a07614431c718f31b894624abf1c0205d3e8728
4
- data.tar.gz: 8da0fe2b68de33fd429a78c6115b37950c6e78c7facbdffbfd73397450c3ded4
3
+ metadata.gz: dc374de89e555a551ec3e4f67ca198a4fd0103d9bc256068b892f2405a049a6a
4
+ data.tar.gz: 8cc382ea4e97c8bbd0f234fcdb8808db495ad4ed487fbe8acb1ce7585c03d4d6
5
5
  SHA512:
6
- metadata.gz: 4b306459da507afde4a3b43894f04c09618414a62d4150dc3b9674dcd5634bd28ca92fe43911c55ca030615ec38964533d47e1d5debe5109f4503be6ea9026f3
7
- data.tar.gz: f6e32498fd1528a6926a07e17b3c9d6b515aa98593ac9be3e35909fb981d247983b5bc5bbbb8aeeb1a5113593f7898f7a9c7ff45bd0cfffaa11fdd3bf1bcaa71
6
+ metadata.gz: 11816342dee7af3574b80824283675823d703232fe39d3170e3f3ad424073584a0f4a95bae6b2ee1218b164a9d845245c2f8fe2ab63043554d2093c00abc7279
7
+ data.tar.gz: 0327fe3d9a9df8ea2957b13e28e1670585241187510a6f047883c2d0e02caea0cbb7ecb05b19f118f333ae46fd3b55d4774e654f72c785fe6cf5493142108fd1
data/README.md CHANGED
@@ -4,10 +4,16 @@
4
4
  ![Build Status](https://github.com/readysteady/month/workflows/Test/badge.svg)
5
5
 
6
6
 
7
- A little Ruby library for working with months.
7
+ Ruby gem for working with months.
8
8
 
9
9
 
10
- ## Installation
10
+ ## Install
11
+
12
+ Using Bundler:
13
+
14
+ $ bundle add month
15
+
16
+ Using RubyGems:
11
17
 
12
18
  $ gem install month
13
19
 
@@ -0,0 +1,23 @@
1
+ require 'yaml'
2
+
3
+ class Month
4
+ def encode_with(coder)
5
+ coder.represent_scalar(nil, to_s)
6
+ end
7
+
8
+ module ScalarScannerPatch
9
+ REGEXP = /\A(\d{4})-(\d{2})\z/
10
+
11
+ def tokenize(string)
12
+ if !string.empty? && string.match(REGEXP)
13
+ return Month.new($1.to_i, $2.to_i)
14
+ end
15
+
16
+ super string
17
+ end
18
+
19
+ YAML::ScalarScanner.prepend(self)
20
+ end
21
+
22
+ private_constant :ScalarScannerPatch
23
+ end
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'month'
3
- s.version = '1.6.0'
3
+ s.version = '1.7.0'
4
4
  s.license = 'MIT'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Tim Craft']
7
7
  s.email = ['mail@timcraft.com']
8
8
  s.homepage = 'https://github.com/readysteady/month'
9
- s.description = 'A little Ruby library for working with months'
9
+ s.description = 'Ruby gem for working with months'
10
10
  s.summary = 'See description'
11
11
  s.files = Dir.glob('lib/**/*.rb') + %w(LICENSE.txt README.md month.gemspec)
12
12
  s.required_ruby_version = '>= 1.9.3'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: month
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Craft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A little Ruby library for working with months
13
+ description: Ruby gem for working with months
14
14
  email:
15
15
  - mail@timcraft.com
16
16
  executables: []
@@ -20,6 +20,7 @@ files:
20
20
  - LICENSE.txt
21
21
  - README.md
22
22
  - lib/month.rb
23
+ - lib/month/yaml.rb
23
24
  - month.gemspec
24
25
  homepage: https://github.com/readysteady/month
25
26
  licenses: