Class: RSpecJSONAPISerializer::Metadata::Relationships
- Inherits:
-
Object
- Object
- RSpecJSONAPISerializer::Metadata::Relationships
- Defined in:
- lib/rspec_jsonapi_serializer/metadata/relationships.rb
Instance Method Summary collapse
-
#initialize(serializer) ⇒ Relationships
constructor
A new instance of Relationships.
- #relationship(key) ⇒ Object
- #relationships ⇒ Object
Constructor Details
#initialize(serializer) ⇒ Relationships
Returns a new instance of Relationships.
9 10 11 |
# File 'lib/rspec_jsonapi_serializer/metadata/relationships.rb', line 9 def initialize(serializer) @serializer = serializer end |
Instance Method Details
#relationship(key) ⇒ Object
13 14 15 |
# File 'lib/rspec_jsonapi_serializer/metadata/relationships.rb', line 13 def relationship(key) relationships.values.find { |relationship| relationship.key.to_s == key.to_s } end |
#relationships ⇒ Object
17 18 19 |
# File 'lib/rspec_jsonapi_serializer/metadata/relationships.rb', line 17 def relationships serializer.class&.relationships_to_serialize || {} end |