Class: CedarPolicy::EntityUid
- Inherits:
-
Object
- Object
- CedarPolicy::EntityUid
- Defined in:
- lib/cedar_policy/entity_uid.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(type_name, id) ⇒ EntityUid
constructor
A new instance of EntityUid.
- #to_hash ⇒ Object
- #to_str ⇒ Object (also: #to_s, #inspect)
Constructor Details
#initialize(type_name, id) ⇒ EntityUid
Returns a new instance of EntityUid.
8 9 10 11 12 13 |
# File 'lib/cedar_policy/entity_uid.rb', line 8 def initialize(type_name, id) @type_name = type_name.to_s @id = id.to_s freeze end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/cedar_policy/entity_uid.rb', line 6 def id @id end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
6 7 8 |
# File 'lib/cedar_policy/entity_uid.rb', line 6 def type_name @type_name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
15 16 17 |
# File 'lib/cedar_policy/entity_uid.rb', line 15 def eql?(other) hash == other.hash end |
#hash ⇒ Object
20 21 22 |
# File 'lib/cedar_policy/entity_uid.rb', line 20 def hash [self.class, @type_name, @id].hash end |
#to_hash ⇒ Object
30 31 32 |
# File 'lib/cedar_policy/entity_uid.rb', line 30 def to_hash { type: @type_name, id: @id } end |
#to_str ⇒ Object Also known as: to_s, inspect
24 25 26 |
# File 'lib/cedar_policy/entity_uid.rb', line 24 def to_str "#{@type_name}::#{@id.inspect}" end |