Class: JSONAPI::PathSegment::Field
- Inherits:
-
Object
- Object
- JSONAPI::PathSegment::Field
- Defined in:
- lib/jsonapi/path_segment.rb
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#resource_klass ⇒ Object
readonly
Returns the value of attribute resource_klass.
Instance Method Summary collapse
- #delegated_field_name ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(resource_klass:, field_name:) ⇒ Field
constructor
A new instance of Field.
- #to_s ⇒ Object
Constructor Details
#initialize(resource_klass:, field_name:) ⇒ Field
Returns a new instance of Field.
56 57 58 59 |
# File 'lib/jsonapi/path_segment.rb', line 56 def initialize(resource_klass:, field_name:) @resource_klass = resource_klass @field_name = field_name end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
54 55 56 |
# File 'lib/jsonapi/path_segment.rb', line 54 def field_name @field_name end |
#resource_klass ⇒ Object (readonly)
Returns the value of attribute resource_klass.
54 55 56 |
# File 'lib/jsonapi/path_segment.rb', line 54 def resource_klass @resource_klass end |
Instance Method Details
#delegated_field_name ⇒ Object
65 66 67 |
# File 'lib/jsonapi/path_segment.rb', line 65 def delegated_field_name resource_klass._attribute_delegated_name(field_name) end |
#eql?(other) ⇒ Boolean
61 62 63 |
# File 'lib/jsonapi/path_segment.rb', line 61 def eql?(other) other.is_a?(JSONAPI::PathSegment::Field) && field_name == other.field_name && resource_klass == other.resource_klass end |
#to_s ⇒ Object
69 70 71 72 73 |
# File 'lib/jsonapi/path_segment.rb', line 69 def to_s # :nocov: "#{resource_klass._type}.#{field_name.to_s}" # :nocov: end |