Class: SBF::Client::Permissions
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- SBF::Client::Permissions
- Defined in:
- lib/stbaldricks/entities/lib/permissions.rb
Constant Summary
Constants inherited from BaseEntity
Instance Attribute Summary collapse
-
#is_owner ⇒ Object
Returns the value of attribute is_owner.
-
#permission_ids ⇒ Object
Returns the value of attribute permission_ids.
Attributes inherited from BaseEntity
Instance Method Summary collapse
Methods inherited from BaseEntity
#add_errors, allow_instantiation?, attr_accessor, attr_reader, attr_writer, attributes, #attributes=, collection_attributes, entity_attr_accessor, entity_attr_reader, entity_attr_writer, entity_attributes, entity_collection_attr_accessor, entity_collection_attr_reader, entity_collection_attr_writer, inherited, #initialize, #model_name, multitype_attr_accessor, multitype_attr_reader, multitype_attr_writer, multitype_collection_attr_accessor, multitype_collection_attr_reader, multitype_collection_attr_writer, #not_provided_attributes, optional_attributes, #persisted?, #to_hash, #to_json
Constructor Details
This class inherits a constructor from SBF::Client::BaseEntity
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/stbaldricks/entities/lib/permissions.rb', line 11 def method_missing(method, *arguments, &block) # If the method starts with 'can', assume they are trying to determine if the user has the permission # in their list of permission ids and return the result if method.to_s.start_with?('can_') const_name = method.to_s.split('can_').last.upcase.to_sym if SBF::Client::Permission.constants(false).include?(const_name) = SBF::Client::Permission.const_get(const_name, false) return .include?() end end super end |
Instance Attribute Details
#is_owner ⇒ Object
Returns the value of attribute is_owner.
8 9 10 |
# File 'lib/stbaldricks/entities/lib/permissions.rb', line 8 def is_owner @is_owner end |
#permission_ids ⇒ Object
Returns the value of attribute permission_ids.
9 10 11 |
# File 'lib/stbaldricks/entities/lib/permissions.rb', line 9 def end |