Class: Cassette::Rubycas::RoutingConstraint
- Inherits:
-
Object
- Object
- Cassette::Rubycas::RoutingConstraint
- Includes:
- UserFactory
- Defined in:
- lib/cassette/rubycas/routing_constraint.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(role, opts = {}) ⇒ RoutingConstraint
constructor
A new instance of RoutingConstraint.
- #matches?(request) ⇒ Boolean
Methods included from UserFactory
Constructor Details
#initialize(role, opts = {}) ⇒ RoutingConstraint
Returns a new instance of RoutingConstraint.
8 9 10 11 12 |
# File 'lib/cassette/rubycas/routing_constraint.rb', line 8 def initialize(role, opts = {}) defaults = { raw: false } @role = role = defaults.merge(opts) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/cassette/rubycas/routing_constraint.rb', line 6 def end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
6 7 8 |
# File 'lib/cassette/rubycas/routing_constraint.rb', line 6 def role @role end |
Instance Method Details
#matches?(request) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/cassette/rubycas/routing_constraint.rb', line 14 def matches?(request) user = from_session(request.session) meth = [:raw] ? :has_raw_role? : :has_role? user.send(meth, role) end |