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.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#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 16 |
# 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) @label = .fetch(:label, name.to_s.humanize) 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 |
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'lib/ez/permissions/resource.rb', line 8 def label @label 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
18 19 20 |
# File 'lib/ez/permissions/resource.rb', line 18 def <=>(other) name <=> other.name end |