Class: RedisAnalytics::PathFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_analytics/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter_path) ⇒ PathFilter

Returns a new instance of PathFilter.



18
19
20
# File 'lib/redis_analytics/filter.rb', line 18

def initialize(filter_path)
  @filter_path = filter_path
end

Instance Attribute Details

#filter_pathObject (readonly)

Returns the value of attribute filter_path.



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

def filter_path
  @filter_path
end

Instance Method Details

#matches?(request_path) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
# File 'lib/redis_analytics/filter.rb', line 22

def matches?(request_path)
  if filter_path.is_a?(String)
    request_path == filter_path
  elsif filter_path.is_a?(Regexp)
    request_path =~ filter_path
  end
end