Class: Xcflushd::Authorization
- Inherits:
-
Struct
- Object
- Struct
- Xcflushd::Authorization
- Defined in:
- lib/xcflushd/authorization.rb,
lib/xcflushd/authorization.rb
Instance Attribute Summary collapse
-
#allowed ⇒ Object
Returns the value of attribute allowed.
-
#reason ⇒ Object
Returns the value of attribute reason.
Class Method Summary collapse
Instance Method Summary collapse
- #authorized? ⇒ Boolean
-
#initialize(authorized, reason = nil) ⇒ Authorization
constructor
A new instance of Authorization.
- #limits_exceeded? ⇒ Boolean
Constructor Details
#initialize(authorized, reason = nil) ⇒ Authorization
Returns a new instance of Authorization.
3 4 5 |
# File 'lib/xcflushd/authorization.rb', line 3 def initialize(, reason = nil) super(, ? nil : reason) end |
Instance Attribute Details
#allowed ⇒ Object
Returns the value of attribute allowed
2 3 4 |
# File 'lib/xcflushd/authorization.rb', line 2 def allowed @allowed end |
#reason ⇒ Object
Returns the value of attribute reason
2 3 4 |
# File 'lib/xcflushd/authorization.rb', line 2 def reason @reason end |
Class Method Details
.allow ⇒ Object
30 31 32 |
# File 'lib/xcflushd/authorization.rb', line 30 def self.allow ALLOWED end |
.deny(reason = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/xcflushd/authorization.rb', line 38 def self.deny(reason = nil) if reason.nil? DENIED # this test has to be done in case the code changes elsif reason == LIMITS_EXCEEDED_CODE LIMITS_EXCEEDED else new(false, reason) end end |
.deny_over_limits ⇒ Object
34 35 36 |
# File 'lib/xcflushd/authorization.rb', line 34 def self.deny_over_limits LIMITS_EXCEEDED end |
Instance Method Details
#authorized? ⇒ Boolean
7 8 9 |
# File 'lib/xcflushd/authorization.rb', line 7 def allowed end |
#limits_exceeded? ⇒ Boolean
26 27 28 |
# File 'lib/xcflushd/authorization.rb', line 26 def limits_exceeded? reason == LIMITS_EXCEEDED_CODE end |