Class: Workarea::BasicAuth::SimpleRouteSet
- Inherits:
-
Object
- Object
- Workarea::BasicAuth::SimpleRouteSet
- Defined in:
- lib/workarea/basic_auth/simple_route_set.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #add(path_string, *http_methods) ⇒ Object
-
#initialize ⇒ SimpleRouteSet
constructor
A new instance of SimpleRouteSet.
- #matches?(request) ⇒ Boolean
- #remove(path_string) ⇒ Object
Constructor Details
#initialize ⇒ SimpleRouteSet
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
#paths ⇒ Object (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
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 |