acts_as_hashable 1.0.3 → 1.0.4
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 +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +9 -2
- data/.ruby-version +1 -1
- data/.travis.yml +14 -2
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +61 -9
- data/Guardfile +16 -0
- data/README.md +32 -4
- data/acts_as_hashable.gemspec +5 -2
- data/bin/console +15 -0
- data/lib/acts_as_hashable/hashable.rb +31 -11
- data/lib/acts_as_hashable/version.rb +1 -1
- data/spec/acts_as_hashable_spec.rb +58 -18
- data/spec/spec_helper.rb +16 -0
- metadata +55 -9
- data/.rubocop_todo.yml +0 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 34122d00042ad3753c5f5535693e547883977104446605839d6193a45b64f8fb
|
|
4
|
+
data.tar.gz: 7f637e61431036291d0c83db0755a2e254e6a08a7847403ae76de976bfebbe88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9531ba6e0a23cdbdc7e32db6ee2b886e0177ab6b1a5f64b003f343556c1a5fa71b521181f9b7df1eec9175316ccb0931979663f26f0f20fd1df0a231aa1077cf
|
|
7
|
+
data.tar.gz: b53371ea96ea5ecc81668be3adf0cb6f9c380d3e82b351a535937174ea150067bcf6a9fa8db5e2663fcc9d0010703e41161b44f112b445aa3af853b1923066f8
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.6.0
|
data/.travis.yml
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
env:
|
|
2
|
+
global:
|
|
3
|
+
- CC_TEST_REPORTER_ID=830db02445429888fcdd7d1406dd82e9b32535e863ac54a538a162c0c4acd4d1
|
|
1
4
|
language: ruby
|
|
2
5
|
rvm:
|
|
3
|
-
|
|
4
|
-
- 2.3.
|
|
6
|
+
# Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
|
|
7
|
+
- 2.3.8
|
|
8
|
+
- 2.4.5
|
|
9
|
+
- 2.5.3
|
|
10
|
+
- 2.6.0
|
|
5
11
|
cache: bundler
|
|
12
|
+
before_script:
|
|
13
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
14
|
+
- chmod +x ./cc-test-reporter
|
|
15
|
+
- ./cc-test-reporter before-build
|
|
6
16
|
script:
|
|
7
17
|
- bundle exec rubocop
|
|
8
18
|
- bundle exec rspec
|
|
19
|
+
after_script:
|
|
20
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,56 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
acts_as_hashable (1.0.
|
|
4
|
+
acts_as_hashable (1.0.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
+
ansi (1.5.0)
|
|
9
10
|
ast (2.4.0)
|
|
11
|
+
coderay (1.1.2)
|
|
10
12
|
diff-lcs (1.3)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
docile (1.3.1)
|
|
14
|
+
ffi (1.10.0)
|
|
15
|
+
formatador (0.2.5)
|
|
16
|
+
guard (2.15.0)
|
|
17
|
+
formatador (>= 0.2.4)
|
|
18
|
+
listen (>= 2.7, < 4.0)
|
|
19
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
20
|
+
nenv (~> 0.1)
|
|
21
|
+
notiffany (~> 0.0)
|
|
22
|
+
pry (>= 0.9.12)
|
|
23
|
+
shellany (~> 0.0)
|
|
24
|
+
thor (>= 0.18.1)
|
|
25
|
+
guard-compat (1.2.1)
|
|
26
|
+
guard-rspec (4.7.3)
|
|
27
|
+
guard (~> 2.1)
|
|
28
|
+
guard-compat (~> 1.1)
|
|
29
|
+
rspec (>= 2.99.0, < 4.0)
|
|
30
|
+
hirb (0.7.3)
|
|
31
|
+
jaro_winkler (1.5.2)
|
|
32
|
+
json (2.1.0)
|
|
33
|
+
listen (3.1.5)
|
|
34
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
35
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
36
|
+
ruby_dep (~> 1.2)
|
|
37
|
+
lumberjack (1.0.13)
|
|
38
|
+
method_source (0.9.2)
|
|
39
|
+
nenv (0.3.0)
|
|
40
|
+
notiffany (0.1.1)
|
|
41
|
+
nenv (~> 0.1)
|
|
42
|
+
shellany (~> 0.0)
|
|
43
|
+
parallel (1.13.0)
|
|
44
|
+
parser (2.6.0.0)
|
|
14
45
|
ast (~> 2.4.0)
|
|
15
46
|
powerpack (0.1.2)
|
|
47
|
+
pry (0.12.2)
|
|
48
|
+
coderay (~> 1.1.0)
|
|
49
|
+
method_source (~> 0.9.0)
|
|
16
50
|
rainbow (3.0.0)
|
|
51
|
+
rb-fsevent (0.10.3)
|
|
52
|
+
rb-inotify (0.10.0)
|
|
53
|
+
ffi (~> 1.0)
|
|
17
54
|
rspec (3.8.0)
|
|
18
55
|
rspec-core (~> 3.8.0)
|
|
19
56
|
rspec-expectations (~> 3.8.0)
|
|
@@ -27,24 +64,39 @@ GEM
|
|
|
27
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
28
65
|
rspec-support (~> 3.8.0)
|
|
29
66
|
rspec-support (3.8.0)
|
|
30
|
-
rubocop (0.
|
|
67
|
+
rubocop (0.63.1)
|
|
31
68
|
jaro_winkler (~> 1.5.1)
|
|
32
69
|
parallel (~> 1.10)
|
|
33
70
|
parser (>= 2.5, != 2.5.1.1)
|
|
34
71
|
powerpack (~> 0.1)
|
|
35
72
|
rainbow (>= 2.2.2, < 4.0)
|
|
36
73
|
ruby-progressbar (~> 1.7)
|
|
37
|
-
unicode-display_width (~> 1.
|
|
74
|
+
unicode-display_width (~> 1.4.0)
|
|
38
75
|
ruby-progressbar (1.10.0)
|
|
39
|
-
|
|
76
|
+
ruby_dep (1.5.0)
|
|
77
|
+
shellany (0.0.1)
|
|
78
|
+
simplecov (0.16.1)
|
|
79
|
+
docile (~> 1.1)
|
|
80
|
+
json (>= 1.8, < 3)
|
|
81
|
+
simplecov-html (~> 0.10.0)
|
|
82
|
+
simplecov-console (0.4.2)
|
|
83
|
+
ansi
|
|
84
|
+
hirb
|
|
85
|
+
simplecov
|
|
86
|
+
simplecov-html (0.10.2)
|
|
87
|
+
thor (0.20.3)
|
|
88
|
+
unicode-display_width (1.4.1)
|
|
40
89
|
|
|
41
90
|
PLATFORMS
|
|
42
91
|
ruby
|
|
43
92
|
|
|
44
93
|
DEPENDENCIES
|
|
45
94
|
acts_as_hashable!
|
|
95
|
+
guard-rspec (~> 4.7)
|
|
46
96
|
rspec
|
|
47
|
-
rubocop (~> 0.
|
|
97
|
+
rubocop (~> 0.63.1)
|
|
98
|
+
simplecov (~> 0.16.1)
|
|
99
|
+
simplecov-console (~> 0.4.2)
|
|
48
100
|
|
|
49
101
|
BUNDLED WITH
|
|
50
|
-
1.
|
|
102
|
+
1.17.2
|
data/Guardfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
|
4
|
+
require 'guard/rspec/dsl'
|
|
5
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
6
|
+
|
|
7
|
+
# RSpec files
|
|
8
|
+
rspec = dsl.rspec
|
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
11
|
+
watch(rspec.spec_files)
|
|
12
|
+
|
|
13
|
+
# Ruby files
|
|
14
|
+
ruby = dsl.ruby
|
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
16
|
+
end
|
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Acts as Hashable
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/bluemarblepayroll/acts_as_hashable)
|
|
3
|
+
[](https://badge.fury.io/rb/acts_as_hashable) [](https://travis-ci.org/bluemarblepayroll/acts_as_hashable) [](https://codeclimate.com/github/bluemarblepayroll/acts_as_hashable/maintainability) [](https://codeclimate.com/github/bluemarblepayroll/acts_as_hashable/test_coverage)
|
|
4
4
|
|
|
5
|
-
This is a small library that helps increase the pliability of object constructor signatures.
|
|
5
|
+
This is a small library that helps increase the pliability of object constructor signatures.
|
|
6
6
|
Instead of instantiating via the constructor, this library can install helper factory
|
|
7
7
|
class-level methods that you can use with hashes:
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ class-level methods that you can use with hashes:
|
|
|
10
10
|
* array(): create an array of instances of a class
|
|
11
11
|
|
|
12
12
|
One caveat to this library is that it is not meant to be a complete modeling solution but rather
|
|
13
|
-
just a tool that helps model a domain or complete a modeling framework.
|
|
13
|
+
just a tool that helps model a domain or complete a modeling framework.
|
|
14
14
|
The main missing element to this library is that you still have to manage and implement constructors.
|
|
15
15
|
The two class-level factory methods are just meant to create a syntactic hash-like interface.
|
|
16
16
|
|
|
@@ -142,9 +142,37 @@ Basic steps to take to get this repository compiling:
|
|
|
142
142
|
To execute the test suite run:
|
|
143
143
|
|
|
144
144
|
````
|
|
145
|
-
rspec spec --format documentation
|
|
145
|
+
bundle exec rspec spec --format documentation
|
|
146
146
|
````
|
|
147
147
|
|
|
148
|
+
Alternatively, you can have Guard watch for changes:
|
|
149
|
+
|
|
150
|
+
````
|
|
151
|
+
bundle exec guard
|
|
152
|
+
````
|
|
153
|
+
|
|
154
|
+
Also, do not forget to run Rubocop:
|
|
155
|
+
|
|
156
|
+
````
|
|
157
|
+
bundle exec rubocop
|
|
158
|
+
````
|
|
159
|
+
|
|
160
|
+
### Publishing
|
|
161
|
+
|
|
162
|
+
Note: ensure you have proper authorization before trying to publish new versions.
|
|
163
|
+
|
|
164
|
+
After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:
|
|
165
|
+
|
|
166
|
+
1. Merge Pull Request into master
|
|
167
|
+
2. Update ```lib/acts_as_hashable/version.rb``` using [semantic versioning](https://semver.org/)
|
|
168
|
+
3. Install dependencies: ```bundle```
|
|
169
|
+
4. Update ```CHANGELOG.md``` with release notes
|
|
170
|
+
5. Commit & push master to remote and ensure CI builds master successfully
|
|
171
|
+
6. Build the project locally: `gem build acts_as_hashable`
|
|
172
|
+
7. Publish package to RubyGems: `gem push acts_as_hashable-X.gem` where X is the version to push
|
|
173
|
+
8. Tag master with new version: `git tag <version>`
|
|
174
|
+
9. Push tags remotely: `git push origin --tags`
|
|
175
|
+
|
|
148
176
|
## License
|
|
149
177
|
|
|
150
178
|
This project is MIT Licensed.
|
data/acts_as_hashable.gemspec
CHANGED
|
@@ -21,8 +21,11 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.homepage = 'https://github.com/bluemarblepayroll/acts_as_hashable'
|
|
22
22
|
s.license = 'MIT'
|
|
23
23
|
|
|
24
|
-
s.required_ruby_version = '>= 2.3.
|
|
24
|
+
s.required_ruby_version = '>= 2.3.8'
|
|
25
25
|
|
|
26
|
+
s.add_development_dependency('guard-rspec', '~>4.7')
|
|
26
27
|
s.add_development_dependency('rspec')
|
|
27
|
-
s.add_development_dependency('rubocop', '~> 0.
|
|
28
|
+
s.add_development_dependency('rubocop', '~> 0.63.1')
|
|
29
|
+
s.add_development_dependency('simplecov', '~>0.16.1')
|
|
30
|
+
s.add_development_dependency('simplecov-console', '~>0.4.2')
|
|
28
31
|
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'acts_as_hashable'
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
+
# require "pry"
|
|
12
|
+
# Pry.start
|
|
13
|
+
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start
|
|
@@ -11,24 +11,44 @@ module ActsAsHashable
|
|
|
11
11
|
# This class contains the main set of class-level methods that can be used by
|
|
12
12
|
# hashable classes.
|
|
13
13
|
module Hashable
|
|
14
|
+
HASHABLE_HYDRATORS = [
|
|
15
|
+
{
|
|
16
|
+
condition: ->(_context, object, _nullable) { object.is_a?(Hash) },
|
|
17
|
+
converter: lambda do |context, object, _nullable|
|
|
18
|
+
context.new(**::ActsAsHashable::Utilities.symbolize_keys(object))
|
|
19
|
+
end
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
condition: ->(context, object, _nullable) { object.is_a?(context) },
|
|
23
|
+
converter: ->(_context, object, _nullable) { object }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
condition: ->(_context, object, nullable) { object.nil? && nullable },
|
|
27
|
+
converter: ->(_context, _object, _nullable) { nil }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
condition: ->(_context, object, nullable) { object.nil? && !nullable },
|
|
31
|
+
converter: ->(context, _object, _nullable) { context.new }
|
|
32
|
+
}
|
|
33
|
+
].freeze
|
|
34
|
+
|
|
35
|
+
private_constant :HASHABLE_HYDRATORS
|
|
36
|
+
|
|
14
37
|
def array(object, nullable: true)
|
|
15
38
|
objects = object.is_a?(Hash) ? [object] : Array(object)
|
|
16
39
|
|
|
17
|
-
objects.
|
|
40
|
+
objects.reject { |o| o == false || o.nil? }
|
|
41
|
+
.map { |o| make(o, nullable: nullable) }
|
|
18
42
|
end
|
|
19
43
|
|
|
20
44
|
def make(object, nullable: true)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
elsif object.nil? && nullable
|
|
26
|
-
nil
|
|
27
|
-
elsif object.nil? && !nullable
|
|
28
|
-
new
|
|
29
|
-
else
|
|
30
|
-
raise "Cannot create hashable object with class name: #{object.class.name}"
|
|
45
|
+
HASHABLE_HYDRATORS.each do |hydrator|
|
|
46
|
+
if hydrator[:condition].call(self, object, nullable)
|
|
47
|
+
return hydrator[:converter].call(self, object, nullable)
|
|
48
|
+
end
|
|
31
49
|
end
|
|
50
|
+
|
|
51
|
+
raise ArgumentError, "Cannot create hashable object with class name: #{object.class.name}"
|
|
32
52
|
end
|
|
33
53
|
end
|
|
34
54
|
end
|
|
@@ -7,12 +7,52 @@
|
|
|
7
7
|
# LICENSE file in the root directory of this source tree.
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
require './
|
|
11
|
-
require './spec/examples'
|
|
10
|
+
require './spec/spec_helper'
|
|
12
11
|
|
|
13
12
|
describe ActsAsHashable do
|
|
14
13
|
context '#make' do
|
|
14
|
+
context 'when passing in unacceptable input' do
|
|
15
|
+
it 'should raise ArgumentError for number' do
|
|
16
|
+
expect { Pet.make(1) }.to raise_error(ArgumentError)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should raise ArgumentError for string' do
|
|
20
|
+
expect { Pet.make('') }.to raise_error(ArgumentError)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should raise ArgumentError for true' do
|
|
24
|
+
expect { Pet.make(true) }.to raise_error(ArgumentError)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should raise ArgumentError for array' do
|
|
28
|
+
expect { Pet.make([]) }.to raise_error(ArgumentError)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
15
32
|
context 'with a hash constructor interface' do
|
|
33
|
+
it 'should properly return object if object is already the same type' do
|
|
34
|
+
original_pet_obj = Pet.new
|
|
35
|
+
pet_obj = Pet.make(original_pet_obj)
|
|
36
|
+
|
|
37
|
+
expect(pet_obj.hash).to eq(original_pet_obj.hash)
|
|
38
|
+
expect(pet_obj.name).to be nil
|
|
39
|
+
expect(pet_obj.toy).to be nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should properly return hydrated object if nil is passed in and is not nullable' do
|
|
43
|
+
pet_obj = Pet.make(nil, nullable: false)
|
|
44
|
+
|
|
45
|
+
expect(pet_obj.name).to be nil
|
|
46
|
+
expect(pet_obj.toy).to be nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'should properly return nil if nil is passed in and is nullable' do
|
|
50
|
+
pet_obj = Pet.make(nil, nullable: false)
|
|
51
|
+
|
|
52
|
+
expect(pet_obj.name).to be nil
|
|
53
|
+
expect(pet_obj.toy).to be nil
|
|
54
|
+
end
|
|
55
|
+
|
|
16
56
|
it 'should properly instantiate objects from a symbol-keyed hash' do
|
|
17
57
|
pet = {
|
|
18
58
|
name: 'Doug the dog',
|
|
@@ -31,11 +71,11 @@ describe ActsAsHashable do
|
|
|
31
71
|
head_of_household = {
|
|
32
72
|
person: {
|
|
33
73
|
name: 'Matt',
|
|
34
|
-
age:
|
|
74
|
+
age: 109
|
|
35
75
|
},
|
|
36
76
|
partner: {
|
|
37
77
|
name: 'Katie',
|
|
38
|
-
age:
|
|
78
|
+
age: 110
|
|
39
79
|
}
|
|
40
80
|
}
|
|
41
81
|
|
|
@@ -47,15 +87,15 @@ describe ActsAsHashable do
|
|
|
47
87
|
expect(head_of_household_obj.partner.age).to eq(110)
|
|
48
88
|
end
|
|
49
89
|
|
|
50
|
-
it 'should properly instantiate objects from
|
|
90
|
+
it 'should properly instantiate objects from string-keyed hash' do
|
|
51
91
|
head_of_household = {
|
|
52
|
-
'person'
|
|
53
|
-
'name'
|
|
54
|
-
'age'
|
|
92
|
+
'person' => {
|
|
93
|
+
'name' => 'Matt',
|
|
94
|
+
'age' => 109
|
|
55
95
|
},
|
|
56
96
|
'partner' => {
|
|
57
|
-
'name'
|
|
58
|
-
'age'
|
|
97
|
+
'name' => 'Katie',
|
|
98
|
+
'age' => 110
|
|
59
99
|
}
|
|
60
100
|
}
|
|
61
101
|
|
|
@@ -71,11 +111,11 @@ describe ActsAsHashable do
|
|
|
71
111
|
head_of_household = {
|
|
72
112
|
person: {
|
|
73
113
|
# name: 'Matt',
|
|
74
|
-
age:
|
|
114
|
+
age: 109
|
|
75
115
|
},
|
|
76
116
|
partner: {
|
|
77
117
|
name: 'Katie',
|
|
78
|
-
age:
|
|
118
|
+
age: 110
|
|
79
119
|
}
|
|
80
120
|
}
|
|
81
121
|
|
|
@@ -86,12 +126,12 @@ describe ActsAsHashable do
|
|
|
86
126
|
head_of_household = {
|
|
87
127
|
person: {
|
|
88
128
|
name: 'Matt',
|
|
89
|
-
age:
|
|
129
|
+
age: 109,
|
|
90
130
|
height_in_inches: 700
|
|
91
131
|
},
|
|
92
132
|
partner: {
|
|
93
133
|
name: 'Katie',
|
|
94
|
-
age:
|
|
134
|
+
age: 110
|
|
95
135
|
}
|
|
96
136
|
}
|
|
97
137
|
|
|
@@ -105,11 +145,11 @@ describe ActsAsHashable do
|
|
|
105
145
|
head_of_household: {
|
|
106
146
|
person: {
|
|
107
147
|
name: 'Matt',
|
|
108
|
-
age:
|
|
148
|
+
age: 109
|
|
109
149
|
},
|
|
110
150
|
partner: {
|
|
111
151
|
name: 'Katie',
|
|
112
|
-
age:
|
|
152
|
+
age: 110
|
|
113
153
|
}
|
|
114
154
|
},
|
|
115
155
|
children: [
|
|
@@ -137,11 +177,11 @@ describe ActsAsHashable do
|
|
|
137
177
|
head_of_household: {
|
|
138
178
|
person: {
|
|
139
179
|
name: 'Matt',
|
|
140
|
-
age:
|
|
180
|
+
age: 109
|
|
141
181
|
},
|
|
142
182
|
partner: {
|
|
143
183
|
name: 'Katie',
|
|
144
|
-
age:
|
|
184
|
+
age: 110
|
|
145
185
|
}
|
|
146
186
|
},
|
|
147
187
|
children: { name: 'Martin', age: 29 }
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2018-present, Blue Marble Payroll, LLC
|
|
5
|
+
#
|
|
6
|
+
# This source code is licensed under the MIT license found in the
|
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
require 'simplecov'
|
|
11
|
+
require 'simplecov-console'
|
|
12
|
+
SimpleCov.formatter = SimpleCov::Formatter::Console
|
|
13
|
+
SimpleCov.start
|
|
14
|
+
|
|
15
|
+
require './lib/acts_as_hashable'
|
|
16
|
+
require './spec/examples'
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acts_as_hashable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew Ruggio
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-02-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: guard-rspec
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4.7'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '4.7'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: rspec
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -30,35 +44,66 @@ dependencies:
|
|
|
30
44
|
requirements:
|
|
31
45
|
- - "~>"
|
|
32
46
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.
|
|
47
|
+
version: 0.63.1
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 0.63.1
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: simplecov
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.16.1
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.16.1
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: simplecov-console
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.4.2
|
|
34
76
|
type: :development
|
|
35
77
|
prerelease: false
|
|
36
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
79
|
requirements:
|
|
38
80
|
- - "~>"
|
|
39
81
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.
|
|
82
|
+
version: 0.4.2
|
|
41
83
|
description: |2
|
|
42
84
|
This is a small library that helps increase the pliability of object constructor signatures.
|
|
43
85
|
Instead of instantiating via the constructor, this library can install helper factory
|
|
44
86
|
class-level methods that you can use with hashes.
|
|
45
87
|
email:
|
|
46
88
|
- mruggio@bluemarblepayroll.com
|
|
47
|
-
executables:
|
|
89
|
+
executables:
|
|
90
|
+
- console
|
|
48
91
|
extensions: []
|
|
49
92
|
extra_rdoc_files: []
|
|
50
93
|
files:
|
|
51
94
|
- ".editorconfig"
|
|
52
95
|
- ".gitignore"
|
|
53
96
|
- ".rubocop.yml"
|
|
54
|
-
- ".rubocop_todo.yml"
|
|
55
97
|
- ".ruby-version"
|
|
56
98
|
- ".travis.yml"
|
|
99
|
+
- CHANGELOG.md
|
|
57
100
|
- Gemfile
|
|
58
101
|
- Gemfile.lock
|
|
102
|
+
- Guardfile
|
|
59
103
|
- LICENSE
|
|
60
104
|
- README.md
|
|
61
105
|
- acts_as_hashable.gemspec
|
|
106
|
+
- bin/console
|
|
62
107
|
- lib/acts_as_hashable.rb
|
|
63
108
|
- lib/acts_as_hashable/acts_as_hashable.rb
|
|
64
109
|
- lib/acts_as_hashable/hashable.rb
|
|
@@ -66,6 +111,7 @@ files:
|
|
|
66
111
|
- lib/acts_as_hashable/version.rb
|
|
67
112
|
- spec/acts_as_hashable_spec.rb
|
|
68
113
|
- spec/examples.rb
|
|
114
|
+
- spec/spec_helper.rb
|
|
69
115
|
homepage: https://github.com/bluemarblepayroll/acts_as_hashable
|
|
70
116
|
licenses:
|
|
71
117
|
- MIT
|
|
@@ -78,18 +124,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
78
124
|
requirements:
|
|
79
125
|
- - ">="
|
|
80
126
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 2.3.
|
|
127
|
+
version: 2.3.8
|
|
82
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
129
|
requirements:
|
|
84
130
|
- - ">="
|
|
85
131
|
- !ruby/object:Gem::Version
|
|
86
132
|
version: '0'
|
|
87
133
|
requirements: []
|
|
88
|
-
|
|
89
|
-
rubygems_version: 2.5.2.3
|
|
134
|
+
rubygems_version: 3.0.1
|
|
90
135
|
signing_key:
|
|
91
136
|
specification_version: 4
|
|
92
137
|
summary: Simple hash-based factory methods for objects.
|
|
93
138
|
test_files:
|
|
94
139
|
- spec/acts_as_hashable_spec.rb
|
|
95
140
|
- spec/examples.rb
|
|
141
|
+
- spec/spec_helper.rb
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2018-09-27 15:44:50 -0500 using RuboCop version 0.59.2.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 5
|
|
10
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
|
11
|
-
# ExcludedMethods: refine
|
|
12
|
-
Metrics/BlockLength:
|
|
13
|
-
Max: 128
|
|
14
|
-
|
|
15
|
-
# Offense count: 1
|
|
16
|
-
Metrics/CyclomaticComplexity:
|
|
17
|
-
Max: 7
|
|
18
|
-
|
|
19
|
-
# Offense count: 1
|
|
20
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
21
|
-
# URISchemes: http, https
|
|
22
|
-
Metrics/LineLength:
|
|
23
|
-
Max: 105
|
|
24
|
-
|
|
25
|
-
# Offense count: 1
|
|
26
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
|
27
|
-
Metrics/MethodLength:
|
|
28
|
-
Max: 11
|
|
29
|
-
|
|
30
|
-
# Offense count: 1
|
|
31
|
-
Metrics/PerceivedComplexity:
|
|
32
|
-
Max: 8
|
|
33
|
-
|
|
34
|
-
# Offense count: 1
|
|
35
|
-
Style/DoubleNegation:
|
|
36
|
-
Exclude:
|
|
37
|
-
- 'lib/acts_as_hashable/hashable.rb'
|
|
38
|
-
|
|
39
|
-
# Offense count: 1
|
|
40
|
-
# Cop supports --auto-correct.
|
|
41
|
-
# Configuration parameters: InverseMethods, InverseBlocks.
|
|
42
|
-
Style/InverseMethods:
|
|
43
|
-
Exclude:
|
|
44
|
-
- 'lib/acts_as_hashable/hashable.rb'
|
|
45
|
-
|
|
46
|
-
# Offense count: 1
|
|
47
|
-
# Cop supports --auto-correct.
|
|
48
|
-
Style/RescueModifier:
|
|
49
|
-
Exclude:
|
|
50
|
-
- 'lib/acts_as_hashable/utilities.rb'
|