Class: JSONAPIonify::Structure::Objects::ResourceIdentifier
- Defined in:
- lib/jsonapionify/structure/objects/resource_identifier.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#errors, #object, #parent, #warnings
Instance Method Summary collapse
- #duplicate_does_not_exist? ⇒ Boolean
- #duplicate_exists? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
Methods inherited from Base
#==, #===, #as_json, #compile, #compile!, #copy, define_order, from_hash, from_json, #initialize, #inspect, #pretty_json, #signature, #to_h, #to_json, #validate
Methods included from Helpers::ObjectDefaults
Methods included from Helpers::Validations
#allowed_type_map, #permitted_key?, #permitted_keys, #permitted_type_for?, #permitted_types_for, #required_key?, #required_keys
Methods included from Helpers::ObjectSetters
Methods included from Helpers::InheritsOrigin
Methods included from Callbacks
Constructor Details
This class inherits a constructor from JSONAPIonify::Structure::Objects::Base
Instance Method Details
#duplicate_does_not_exist? ⇒ Boolean
29 30 31 |
# File 'lib/jsonapionify/structure/objects/resource_identifier.rb', line 29 def duplicate_does_not_exist? !duplicate_exists? end |
#duplicate_exists? ⇒ Boolean
24 25 26 27 |
# File 'lib/jsonapionify/structure/objects/resource_identifier.rb', line 24 def duplicate_exists? return false unless parent.is_a?(Array) parent.select { |peer| peer.eql? self }.length > 1 end |
#eql?(other) ⇒ Boolean
37 38 39 |
# File 'lib/jsonapionify/structure/objects/resource_identifier.rb', line 37 def eql?(other) other.hash == self.hash end |
#hash ⇒ Object
33 34 35 |
# File 'lib/jsonapionify/structure/objects/resource_identifier.rb', line 33 def hash { type: self[:type], id: self[:id] }.hash end |