qo 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qo/matcher.rb +13 -3
- data/lib/qo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4df3208a180d13d368677f8fe821106fe073a992
|
4
|
+
data.tar.gz: 5cb7a3d0157be3e78ef5b3eec297886fbf914188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab4868303500073f978e621d268f74537eb4d8e48139bd8ab9aab82effe3fe7c835c431058bf214ce5ddd4878337a4c937303e66ad13f6433fa72640039fb05
|
7
|
+
data.tar.gz: 28ab8ae79d276a5ce96a8c05eb4fd2edc8febe460bd7b65d0ed4acbea96b1b647ddf9b21eea5bcd41a2be1417cb9ae032b6a4f54d5b6e4edd77876cf63059a71
|
data/lib/qo/matcher.rb
CHANGED
@@ -12,9 +12,11 @@ module Qo
|
|
12
12
|
#
|
13
13
|
# @return [Proc]
|
14
14
|
def to_proc
|
15
|
-
@array_matchers.empty?
|
16
|
-
match_against_hash(@keyword_matchers)
|
15
|
+
if @array_matchers.empty?
|
16
|
+
match_against_hash(@keyword_matchers)
|
17
|
+
else
|
17
18
|
match_against_array(@array_matchers)
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
# You can directly call a matcher as well, much like a Proc,
|
@@ -98,7 +100,15 @@ module Qo
|
|
98
100
|
# String | Symbol -> Bool # Match against wildcard or boolean return of a predicate method
|
99
101
|
private def array_matches_object_fn(match_target)
|
100
102
|
-> matcher {
|
101
|
-
matcher == WILDCARD_MATCH ||
|
103
|
+
matcher == WILDCARD_MATCH ||
|
104
|
+
matcher === match_target || (
|
105
|
+
# Check if the matcher is a symbol / symbolizeable and
|
106
|
+
# if it's on the public interface. This is to give
|
107
|
+
# the ability to avoid using :sym.to_proc for method calls.
|
108
|
+
matcher.respond_to?(:to_sym) &&
|
109
|
+
match_target.respond_to?(matcher.to_sym) &&
|
110
|
+
match_target.public_send(matcher)
|
111
|
+
)
|
102
112
|
}
|
103
113
|
end
|
104
114
|
|
data/lib/qo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Weaver
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.6.12
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Qo is a querying library for Ruby pattern matching
|