qo 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qo/matcher.rb +13 -3
  3. data/lib/qo/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77e3ec860cc023f34436da2fc2177007574673bb
4
- data.tar.gz: f7e09d7967b02518f8da0a7176ad655bc35a2395
3
+ metadata.gz: 4df3208a180d13d368677f8fe821106fe073a992
4
+ data.tar.gz: 5cb7a3d0157be3e78ef5b3eec297886fbf914188
5
5
  SHA512:
6
- metadata.gz: 64b6464ddbf2eb4d00ece478673760d9ee33e0d7a6bb5777478756946a6943ea273a9fdb811143e4e960628239eaf381af37c28d5d314d5af90ba64f11fc671a
7
- data.tar.gz: 9dc57edb473939227ed4863cbcd8a524e3afc3097186331ced7662792b235ba09df45e6e0322083b2d5131b164a01f47a74ebb4a5c8fae473800ea958a0ecb24
6
+ metadata.gz: 8ab4868303500073f978e621d268f74537eb4d8e48139bd8ab9aab82effe3fe7c835c431058bf214ce5ddd4878337a4c937303e66ad13f6433fa72640039fb05
7
+ data.tar.gz: 28ab8ae79d276a5ce96a8c05eb4fd2edc8febe460bd7b65d0ed4acbea96b1b647ddf9b21eea5bcd41a2be1417cb9ae032b6a4f54d5b6e4edd77876cf63059a71
@@ -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 || match_target.public_send(matcher)
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
 
@@ -1,3 +1,3 @@
1
1
  module Qo
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
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.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-10 00:00:00.000000000 Z
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.5.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