context-filters 0.0.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8430ac712eba84a90d2ab08862e6e0142da1b748
|
4
|
+
data.tar.gz: 126e1743e161e5fef693d9b7b5727b6c983d2cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8cdbf06f99de8383c8f58a3b43e632dd9ea6efce6da803059e3b1a370d4dcc94881bacce51aff79b1570ef9b90c928f3ab295e121928dd7389958b7c3d3d5f6
|
7
|
+
data.tar.gz: fb036b5357b25b824b63f577e5a3f897c80d2c015df1f46938f9849e966eda20626997ca8a60fb5d31c3d9aacb1d13f43f9d4a678ab33a8e9dd58d52a5dc88fb
|
@@ -9,11 +9,12 @@ require "context-filters/local_context"
|
|
9
9
|
|
10
10
|
# manipulate set of context and filters for it,
|
11
11
|
# allow evaluating filters in given context
|
12
|
-
class ContextFilters::Context <
|
12
|
+
class ContextFilters::Context < ContextFilters::GlobalContext
|
13
13
|
|
14
14
|
include ContextFilters::LocalContext
|
15
15
|
|
16
16
|
# run the given method on global and local filters
|
17
|
+
# @param method [Proc] the method to evaluate for filters matching context
|
17
18
|
def evaluate_filters(method)
|
18
19
|
super(method) do
|
19
20
|
evaluate_local_filters(method)
|
@@ -11,9 +11,11 @@ require "context-filters/priority_filters"
|
|
11
11
|
class ContextFilters::GlobalContext
|
12
12
|
|
13
13
|
# @return [Array] the context stack
|
14
|
+
# @api private
|
14
15
|
attr_reader :context
|
15
16
|
|
16
17
|
# @return [PriorityFilters] shared list of filters
|
18
|
+
# @api private
|
17
19
|
attr_reader :priority_filters
|
18
20
|
|
19
21
|
# initialize new GlobalContext, works in two modes:
|
@@ -10,6 +10,7 @@ require "context-filters/version"
|
|
10
10
|
module ContextFilters::LocalContext
|
11
11
|
|
12
12
|
# @return [Array<Proc>] list of blocks to evaluate
|
13
|
+
# @api private
|
13
14
|
def local_filters
|
14
15
|
@local_filters ||= []
|
15
16
|
end
|
@@ -32,6 +33,7 @@ module ContextFilters::LocalContext
|
|
32
33
|
#
|
33
34
|
# @param method [Proc] a method to call with each filter stored in
|
34
35
|
# +local_filters+
|
36
|
+
# @api private
|
35
37
|
def evaluate_local_filters(method)
|
36
38
|
local_filters.each { |block| method.call(&block) }
|
37
39
|
end
|
@@ -9,6 +9,7 @@ require "context-filters/filters"
|
|
9
9
|
# list of +filters+ sorted by +priorities+
|
10
10
|
class ContextFilters::PriorityFilters
|
11
11
|
|
12
|
+
# @return [Array] list of priorities this object was initialized with
|
12
13
|
attr_reader :priorities
|
13
14
|
|
14
15
|
# initializes priorities and coresponding list of filters
|