hash_at_path 0.1.5 → 0.1.6
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/.travis.yml +5 -3
- data/hash_at_path.gemspec +13 -12
- data/lib/hash_at_path/path.rb +7 -4
- data/lib/hash_at_path/version.rb +3 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d9f5b0a2917bdf1119fcbde29bc0553d0b129d05cd37a8300e5444d647877be
|
4
|
+
data.tar.gz: ff184eb411d56d2075557fa35ef47c2c110d05a2735ea4cde1405eb484d7bc9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9ffdfd6f03a658740e170eb474bfe49973b29be63ec5de545a8f797d6cd8b354c8a6527816cd0d8473ac9b0e00772893067c21ccf0a9fa1962eca8d199ddde
|
7
|
+
data.tar.gz: 5c33bba88b68c4d908459af8d112b5f8022cd0ec3b7482e05c3c10015fd6653229cf50cebce6cf76099c4e6e7b565d4f7fd74cfeb7262553e0bd5ed903a15f27
|
data/.travis.yml
CHANGED
data/hash_at_path.gemspec
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'hash_at_path/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'hash_at_path'
|
8
9
|
spec.version = HashAtPath::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['chadfennell']
|
11
|
+
spec.email = ['libsys@gmail.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.summary = 'Extends Hash with xpath like syntax for retrieving hash values.'
|
14
|
+
spec.homepage = 'https://github.com/UMNLibraries/hash_at_path'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
18
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
20
21
|
|
21
22
|
spec.required_ruby_version = '>= 2.1'
|
22
23
|
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
25
26
|
end
|
data/lib/hash_at_path/path.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module HashAtPath
|
2
4
|
class Path
|
3
5
|
class << self
|
@@ -7,18 +9,19 @@ module HashAtPath
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def replace_predicates(path_string)
|
10
|
-
path_string.gsub
|
11
|
-
path_string.gsub
|
12
|
+
path_string = path_string.gsub(/first\(\)/, '0')
|
13
|
+
path_string = path_string.gsub(/last\(\)/, '-1')
|
12
14
|
path_string
|
13
15
|
end
|
14
16
|
|
15
17
|
# Extracts paths and predicates from the provide full path
|
16
18
|
def extract_path_data(path_string)
|
17
19
|
results = array_wrap(path_string.scan(/([^\[]*)(\[)*(\d|\-\d|\*)*(\])*/i))
|
18
|
-
results.map {|match| {:
|
20
|
+
results.map { |match| { path: match[0], predicate: match[2] } }
|
19
21
|
end
|
20
22
|
|
21
23
|
private
|
24
|
+
|
22
25
|
# Stolen from activesupport/lib/active_support/core_ext/array/wrap.rb
|
23
26
|
def array_wrap(object)
|
24
27
|
if object.nil?
|
@@ -31,4 +34,4 @@ module HashAtPath
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
34
|
-
end
|
37
|
+
end
|
data/lib/hash_at_path/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_at_path
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chadfennell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 12.3.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 12.3.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.5.1
|
81
|
+
rubygems_version: 3.0.6
|
83
82
|
signing_key:
|
84
83
|
specification_version: 4
|
85
84
|
summary: Extends Hash with xpath like syntax for retrieving hash values.
|