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.



8
9
10
# File 'lib/rshade/filter/include_path_filter.rb', line 8

def initialize
  @paths = []
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



4
5
6
# File 'lib/rshade/filter/include_path_filter.rb', line 4

def paths
  @paths
end

Instance Method Details

#call(event) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/rshade/filter/include_path_filter.rb', line 20

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



29
30
31
# File 'lib/rshade/filter/include_path_filter.rb', line 29

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

#nameObject



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

def name
  NAME
end

#priorityObject



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

def priority
  1
end