Class: RShade::Filter::IncludePathFilter

Inherits:
AbstractFilter show all
Defined in:
lib/rshade/filter/include_path_filter.rb

Direct Known Subclasses

ExcludePathFilter

Constant Summary collapse

NAME =
:include_paths

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractFilter

#config

Constructor Details

#initializeIncludePathFilter

Returns a new instance of IncludePathFilter.



10
11
12
13
# File 'lib/rshade/filter/include_path_filter.rb', line 10

def initialize
  super
  @paths = []
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



6
7
8
# File 'lib/rshade/filter/include_path_filter.rb', line 6

def paths
  @paths
end

Instance Method Details

#call(event) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/rshade/filter/include_path_filter.rb', line 23

def call(event)
  event_path = event.path
  paths.any? do |path|
    next str?(path, event_path) if path.is_a? String
    next regexp?(path, event_path) if path.is_a? Regexp

    false
  end
end

#config_call(&block) ⇒ Object



33
34
35
# File 'lib/rshade/filter/include_path_filter.rb', line 33

def config_call(&block)
  block.call(@paths)
end

#nameObject



15
16
17
# File 'lib/rshade/filter/include_path_filter.rb', line 15

def name
  NAME
end

#priorityObject



19
20
21
# File 'lib/rshade/filter/include_path_filter.rb', line 19

def priority
  1
end