hashematics 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/CHANGELOG.md +4 -0
- data/Gemfile.lock +10 -1
- data/Guardfile +1 -1
- data/README.md +8 -9
- data/Rakefile +8 -0
- data/hashematics.gemspec +4 -0
- data/lib/hashematics.rb +28 -1
- data/lib/hashematics/object_interface.rb +3 -11
- data/lib/hashematics/version.rb +1 -1
- data/spec/spec_helper.rb +11 -5
- metadata +45 -5
- data/lib/hashematics/hashematics.rb +0 -36
- data/spec/hashematics/object_interface_spec.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c22870141347d2318224a31bac79c1496d5e8dcc936c67a625fbbe7b1a9b539e
|
4
|
+
data.tar.gz: 867a235327143ab4cbc5aa12eb3abcc68163c5e626ffbfb3ff56d65370e5c2dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1578d7ab5cb7c1a9b1bc1a6eb79a7d5561f321eb0d0a419fd36f3c943d339e543a2bf2c84fbf922e436a22c50cd8089ac766e70828f053b1e029f475682027e0
|
7
|
+
data.tar.gz: 58b4cf29fed3b1ee52eabb8d49f5c23967ec605f5e7b984bd893f1678151c0cd720147227536c7e37d4aa4af1fef2523e12d67bd8ee4c206d2a40c24d6a79907
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hashematics (1.
|
4
|
+
hashematics (1.1.0)
|
5
|
+
objectable (~> 1)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
@@ -10,6 +11,7 @@ GEM
|
|
10
11
|
afm (0.2.2)
|
11
12
|
ansi (1.5.0)
|
12
13
|
ast (2.4.0)
|
14
|
+
byebug (11.0.1)
|
13
15
|
coderay (1.1.2)
|
14
16
|
concurrent-ruby (1.1.5)
|
15
17
|
diff-lcs (1.3)
|
@@ -48,6 +50,7 @@ GEM
|
|
48
50
|
notiffany (0.1.1)
|
49
51
|
nenv (~> 0.1)
|
50
52
|
shellany (~> 0.0)
|
53
|
+
objectable (1.0.0)
|
51
54
|
parallel (1.13.0)
|
52
55
|
parser (2.6.0.0)
|
53
56
|
ast (~> 2.4.0)
|
@@ -63,7 +66,11 @@ GEM
|
|
63
66
|
pry (0.12.2)
|
64
67
|
coderay (~> 1.1.0)
|
65
68
|
method_source (~> 0.9.0)
|
69
|
+
pry-byebug (3.7.0)
|
70
|
+
byebug (~> 11.0)
|
71
|
+
pry (~> 0.10)
|
66
72
|
rainbow (3.0.0)
|
73
|
+
rake (10.5.0)
|
67
74
|
rb-fsevent (0.10.3)
|
68
75
|
rb-inotify (0.9.10)
|
69
76
|
ffi (>= 0.5.0, < 2)
|
@@ -114,6 +121,8 @@ DEPENDENCIES
|
|
114
121
|
hashematics!
|
115
122
|
pdf-inspector (~> 1)
|
116
123
|
pry (~> 0)
|
124
|
+
pry-byebug (~> 3)
|
125
|
+
rake (~> 10.0)
|
117
126
|
rspec (~> 3.8)
|
118
127
|
rubocop (~> 0.63.1)
|
119
128
|
simplecov (~> 0.16.1)
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -383,11 +383,13 @@ The `objects` variable should now look like:
|
|
383
383
|
|
384
384
|
Records with blank ID's are ignored by default. This is due to the flat nature of the incoming data. Take the following example:
|
385
385
|
|
386
|
-
ID #
|
387
|
-
|
388
|
-
1
|
389
|
-
2
|
390
|
-
|
|
386
|
+
ID # | First Name | Last Name | Costume ID # | Costume Name | Costume Color
|
387
|
+
------ | ---------- | --------- | ------------ | ------------ | -------------
|
388
|
+
1 | Bruce | Banner | 3 | Basic Hulk | Green
|
389
|
+
2 | Tony | Stark | *null* | *null* | *null*
|
390
|
+
*null* | *null* | *null* | 4 | Undercover | Purple
|
391
|
+
|
392
|
+
*Note: null is shown for blank values so the markdown renders properly.*
|
391
393
|
|
392
394
|
This is interpreted as:
|
393
395
|
|
@@ -650,10 +652,7 @@ After code changes have successfully gone through the Pull Request review proces
|
|
650
652
|
3. Install dependencies: ```bundle```
|
651
653
|
4. Update ```CHANGELOG.md``` with release notes
|
652
654
|
5. Commit & push master to remote and ensure CI builds master successfully
|
653
|
-
6.
|
654
|
-
7. Publish package to RubyGems: `gem push hashematics-X.gem` where X is the version to push
|
655
|
-
8. Tag master with new version: `git tag <version>`
|
656
|
-
9. Push tags remotely: `git push origin --tags`
|
655
|
+
6. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
657
656
|
|
658
657
|
## License
|
659
658
|
|
data/Rakefile
ADDED
data/hashematics.gemspec
CHANGED
@@ -21,10 +21,14 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.required_ruby_version = '>= 2.3.8'
|
23
23
|
|
24
|
+
s.add_dependency('objectable', '~>1')
|
25
|
+
|
24
26
|
s.add_development_dependency('faker', '~>1')
|
25
27
|
s.add_development_dependency('guard-rspec', '~>4.7')
|
26
28
|
s.add_development_dependency('pdf-inspector', '~>1')
|
27
29
|
s.add_development_dependency('pry', '~>0')
|
30
|
+
s.add_development_dependency('pry-byebug', '~> 3')
|
31
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
28
32
|
s.add_development_dependency('rspec', '~> 3.8')
|
29
33
|
s.add_development_dependency('rubocop', '~>0.63.1')
|
30
34
|
s.add_development_dependency('simplecov', '~>0.16.1')
|
data/lib/hashematics.rb
CHANGED
@@ -7,4 +7,31 @@
|
|
7
7
|
# LICENSE file in the root directory of this source tree.
|
8
8
|
#
|
9
9
|
|
10
|
-
|
10
|
+
require 'digest'
|
11
|
+
require 'forwardable'
|
12
|
+
require 'objectable'
|
13
|
+
require 'ostruct'
|
14
|
+
|
15
|
+
require_relative 'hashematics/category'
|
16
|
+
require_relative 'hashematics/configuration'
|
17
|
+
require_relative 'hashematics/dictionary'
|
18
|
+
require_relative 'hashematics/graph'
|
19
|
+
require_relative 'hashematics/group'
|
20
|
+
require_relative 'hashematics/key'
|
21
|
+
require_relative 'hashematics/id'
|
22
|
+
require_relative 'hashematics/object_interface'
|
23
|
+
require_relative 'hashematics/record'
|
24
|
+
require_relative 'hashematics/record_set'
|
25
|
+
require_relative 'hashematics/type'
|
26
|
+
require_relative 'hashematics/visitor'
|
27
|
+
|
28
|
+
# Top-level API syntactic sugar that holds the common library use(s).
|
29
|
+
module Hashematics
|
30
|
+
class << self
|
31
|
+
def graph(config: {}, rows: [])
|
32
|
+
groups = Configuration.new(config).groups
|
33
|
+
|
34
|
+
Graph.new(groups).add(rows)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -14,21 +14,13 @@ module Hashematics
|
|
14
14
|
class ObjectInterface
|
15
15
|
class << self
|
16
16
|
def get(object, key)
|
17
|
-
|
18
|
-
indifferent_hash_get(object, key)
|
19
|
-
elsif object.respond_to?(key)
|
20
|
-
object.send(key)
|
21
|
-
end
|
17
|
+
resolver.get(object, key)
|
22
18
|
end
|
23
19
|
|
24
20
|
private
|
25
21
|
|
26
|
-
def
|
27
|
-
|
28
|
-
hash[key.to_s]
|
29
|
-
elsif hash.key?(key.to_s.to_sym)
|
30
|
-
hash[key.to_s.to_sym]
|
31
|
-
end
|
22
|
+
def resolver
|
23
|
+
@resolver ||= Objectable.resolver(separator: nil)
|
32
24
|
end
|
33
25
|
end
|
34
26
|
end
|
data/lib/hashematics/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -7,13 +7,19 @@
|
|
7
7
|
# LICENSE file in the root directory of this source tree.
|
8
8
|
#
|
9
9
|
|
10
|
-
require 'pry'
|
11
10
|
require 'csv'
|
11
|
+
require 'pry'
|
12
|
+
require 'pry-byebug'
|
12
13
|
|
13
|
-
|
14
|
-
require 'simplecov
|
15
|
-
|
16
|
-
|
14
|
+
unless ENV['DISABLE_SIMPLECOV'] == 'true'
|
15
|
+
require 'simplecov'
|
16
|
+
require 'simplecov-console'
|
17
|
+
|
18
|
+
SimpleCov.formatter = SimpleCov::Formatter::Console
|
19
|
+
SimpleCov.start do
|
20
|
+
add_filter %r{\A/spec/}
|
21
|
+
end
|
22
|
+
end
|
17
23
|
|
18
24
|
require './lib/hashematics'
|
19
25
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashematics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: objectable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: faker
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,34 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: rspec
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,6 +185,7 @@ files:
|
|
143
185
|
- Guardfile
|
144
186
|
- LICENSE
|
145
187
|
- README.md
|
188
|
+
- Rakefile
|
146
189
|
- bin/benchmark
|
147
190
|
- bin/console
|
148
191
|
- hashematics.gemspec
|
@@ -152,7 +195,6 @@ files:
|
|
152
195
|
- lib/hashematics/dictionary.rb
|
153
196
|
- lib/hashematics/graph.rb
|
154
197
|
- lib/hashematics/group.rb
|
155
|
-
- lib/hashematics/hashematics.rb
|
156
198
|
- lib/hashematics/id.rb
|
157
199
|
- lib/hashematics/key.rb
|
158
200
|
- lib/hashematics/object_interface.rb
|
@@ -168,7 +210,6 @@ files:
|
|
168
210
|
- spec/hashematics/category_spec.rb
|
169
211
|
- spec/hashematics/graph_spec.rb
|
170
212
|
- spec/hashematics/key_spec.rb
|
171
|
-
- spec/hashematics/object_interface_spec.rb
|
172
213
|
- spec/hashematics/record_set_spec.rb
|
173
214
|
- spec/hashematics/record_spec.rb
|
174
215
|
- spec/hashematics/type_spec.rb
|
@@ -204,7 +245,6 @@ test_files:
|
|
204
245
|
- spec/hashematics/category_spec.rb
|
205
246
|
- spec/hashematics/graph_spec.rb
|
206
247
|
- spec/hashematics/key_spec.rb
|
207
|
-
- spec/hashematics/object_interface_spec.rb
|
208
248
|
- spec/hashematics/record_set_spec.rb
|
209
249
|
- spec/hashematics/record_spec.rb
|
210
250
|
- spec/hashematics/type_spec.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2019-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 'digest'
|
11
|
-
require 'forwardable'
|
12
|
-
require 'ostruct'
|
13
|
-
|
14
|
-
require_relative 'category'
|
15
|
-
require_relative 'configuration'
|
16
|
-
require_relative 'dictionary'
|
17
|
-
require_relative 'graph'
|
18
|
-
require_relative 'group'
|
19
|
-
require_relative 'key'
|
20
|
-
require_relative 'id'
|
21
|
-
require_relative 'object_interface'
|
22
|
-
require_relative 'record'
|
23
|
-
require_relative 'record_set'
|
24
|
-
require_relative 'type'
|
25
|
-
require_relative 'visitor'
|
26
|
-
|
27
|
-
# Top-level API syntactic sugar that holds the common library use(s).
|
28
|
-
module Hashematics
|
29
|
-
class << self
|
30
|
-
def graph(config: {}, rows: [])
|
31
|
-
groups = ::Hashematics::Configuration.new(config).groups
|
32
|
-
|
33
|
-
::Hashematics::Graph.new(groups).add(rows)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2019-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 'spec_helper'
|
11
|
-
require 'examples/person'
|
12
|
-
|
13
|
-
describe ::Hashematics::ObjectInterface do
|
14
|
-
let(:input) do
|
15
|
-
{
|
16
|
-
id: 1,
|
17
|
-
'first' => 'Matt'
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:person) { Person.new(input) }
|
22
|
-
|
23
|
-
it 'should read hash indifferently' do
|
24
|
-
expect(described_class.get(input, :id)).to eq(input[:id])
|
25
|
-
expect(described_class.get(input, 'id')).to eq(input[:id])
|
26
|
-
expect(described_class.get(input, :first)).to eq(input['first'])
|
27
|
-
expect(described_class.get(input, 'first')).to eq(input['first'])
|
28
|
-
|
29
|
-
expect(described_class.get(person, 'doesnt_exist')).to eq(nil)
|
30
|
-
expect(described_class.get(person, :doesnt_exist)).to eq(nil)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should read object if object is responsive' do
|
34
|
-
expect(described_class.get(person, :id)).to eq(input[:id])
|
35
|
-
expect(described_class.get(person, 'id')).to eq(input[:id])
|
36
|
-
expect(described_class.get(person, :first)).to eq(input['first'])
|
37
|
-
expect(described_class.get(person, 'first')).to eq(input['first'])
|
38
|
-
|
39
|
-
expect(described_class.get(person, 'doesnt_exist')).to eq(nil)
|
40
|
-
expect(described_class.get(person, :doesnt_exist)).to eq(nil)
|
41
|
-
end
|
42
|
-
end
|