Class: Only::BaseConstraint
- Inherits:
-
Object
- Object
- Only::BaseConstraint
- Defined in:
- lib/only/base_constraint.rb
Class Attribute Summary collapse
-
.request ⇒ Object
Returns the value of attribute request.
Class Method Summary collapse
- .matches?(request) ⇒ Boolean
- .params(attribute = nil) ⇒ Object
-
.requested_domain ⇒ Object
Get the domain name from the request URL.
Class Attribute Details
.request ⇒ Object
Returns the value of attribute request.
4 5 6 |
# File 'lib/only/base_constraint.rb', line 4 def request @request end |
Class Method Details
.matches?(request) ⇒ Boolean
6 7 8 9 |
# File 'lib/only/base_constraint.rb', line 6 def matches?(request) self.request = request condition_matches? end |
.params(attribute = nil) ⇒ Object
16 17 18 |
# File 'lib/only/base_constraint.rb', line 16 def params(attribute = nil) attribute ? request.params[attribute] : request.params end |
.requested_domain ⇒ Object
Get the domain name from the request URL
12 13 14 |
# File 'lib/only/base_constraint.rb', line 12 def requested_domain %r{//([^/]+)}.match(request.url)[1] end |