Class: Workarea::BasicAuth::SimpleRouteSet

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/basic_auth/simple_route_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSimpleRouteSet

Returns a new instance of SimpleRouteSet.



6
7
8
# File 'lib/workarea/basic_auth/simple_route_set.rb', line 6

def initialize
  @paths = []
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



4
5
6
# File 'lib/workarea/basic_auth/simple_route_set.rb', line 4

def paths
  @paths
end

Instance Method Details

#add(path_string, *http_methods) ⇒ Object



10
11
12
# File 'lib/workarea/basic_auth/simple_route_set.rb', line 10

def add(path_string, *http_methods)
  paths.push(Path.new(path_string, *http_methods))
end

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/workarea/basic_auth/simple_route_set.rb', line 18

def matches?(request)
  paths.detect { |path| path.matches?(request) }.present?
end

#remove(path_string) ⇒ Object



14
15
16
# File 'lib/workarea/basic_auth/simple_route_set.rb', line 14

def remove(path_string)
  @paths = paths.reject { |path| path.matches?(path_string) }
end