delorean_lang 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/delorean/ruby/whitelists/matchers/method.rb +13 -2
- data/lib/delorean/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2c68ada6d28bb5e65382a50c03e73518273929711569c689cba11387583cc5c9
|
4
|
+
data.tar.gz: 6a5ec88595b66cfc946f03337bdec9dc470ea8f1d31f47820b82424b8d039ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f49e8633ba3e904ee9341f97682773919cb546316e6a06eab3dc5fa575c63a57720e2fb4bf5f95a5bf9f8b465cf525305232e00fa4eeac2a4fcb3d26dbcdff0
|
7
|
+
data.tar.gz: f17a7f9f187a55fca8ba0c4d1dad11c7f4c62d265f4c92e8fbafb92c932bda6d8c1d935a9d70e876c3c3d65f9fe74e32fc94d2c2b59d54fa98fb671db75fc00d
|
@@ -7,12 +7,16 @@ module Delorean
|
|
7
7
|
module Whitelists
|
8
8
|
module Matchers
|
9
9
|
class Method
|
10
|
-
attr_reader :method_name,
|
10
|
+
attr_reader :method_name,
|
11
|
+
:match_to,
|
12
|
+
:arguments_matchers,
|
13
|
+
:arguments_matchers_hash
|
11
14
|
|
12
15
|
def initialize(method_name:, match_to: nil)
|
13
16
|
@method_name = method_name
|
14
17
|
@match_to = match_to
|
15
18
|
@arguments_matchers = []
|
19
|
+
@arguments_matchers_hash = {}
|
16
20
|
|
17
21
|
yield self if block_given?
|
18
22
|
end
|
@@ -22,6 +26,8 @@ module Delorean
|
|
22
26
|
called_on: klass, method_name: method_name, with: with
|
23
27
|
)
|
24
28
|
|
29
|
+
arguments_matchers_hash[klass] = matcher
|
30
|
+
|
25
31
|
arguments_matchers << matcher
|
26
32
|
|
27
33
|
# Sort matchers by reversed ancestors chain length, so
|
@@ -32,7 +38,12 @@ module Delorean
|
|
32
38
|
end
|
33
39
|
|
34
40
|
def matcher(klass:)
|
35
|
-
matcher
|
41
|
+
# Optimization hack: Look for exact class matcher in hash.
|
42
|
+
# If it's not found, search for ancestor classes matchers in array
|
43
|
+
matcher = @arguments_matchers_hash[klass]
|
44
|
+
return matcher unless matcher.nil?
|
45
|
+
|
46
|
+
matcher = @arguments_matchers.find do |matcher_object|
|
36
47
|
klass <= matcher_object.called_on
|
37
48
|
end
|
38
49
|
|
data/lib/delorean/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delorean_lang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.7.8
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Delorean compiler
|