Class: Ez::Permissions::Resource
- Inherits:
-
Object
- Object
- Ez::Permissions::Resource
- Defined in:
- lib/ez/permissions/resource.rb
Constant Summary collapse
- ACTIONS =
%i[create read update delete].freeze
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(name, options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(name, options = {}) ⇒ Resource
Returns a new instance of Resource.
10 11 12 13 14 15 |
# File 'lib/ez/permissions/resource.rb', line 10 def initialize(name, = {}) @name = name @model = .fetch(:model, nil) @actions = process_actions(.fetch(:actions, [])) @group = .fetch(:group, :others) end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
8 9 10 |
# File 'lib/ez/permissions/resource.rb', line 8 def actions @actions end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
8 9 10 |
# File 'lib/ez/permissions/resource.rb', line 8 def group @group end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'lib/ez/permissions/resource.rb', line 8 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/ez/permissions/resource.rb', line 8 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
17 18 19 |
# File 'lib/ez/permissions/resource.rb', line 17 def <=>(other) name <=> other.name end |