Class: JSONAPI::Association
- Inherits:
-
Object
- Object
- JSONAPI::Association
- Defined in:
- lib/jsonapi/association.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#acts_as_set ⇒ Object
readonly
Returns the value of attribute acts_as_set.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#primary_key ⇒ Object
readonly
Returns the value of attribute primary_key.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Association
constructor
A new instance of Association.
Constructor Details
#initialize(name, options = {}) ⇒ Association
Returns a new instance of Association.
5 6 7 8 9 10 11 |
# File 'lib/jsonapi/association.rb', line 5 def initialize(name, ={}) @name = name.to_s @options = @key = [:key] ? [:key].to_sym : nil @primary_key = .fetch(:primary_key, 'id').to_sym @acts_as_set = .fetch(:acts_as_set, false) == true end |
Instance Attribute Details
#acts_as_set ⇒ Object (readonly)
Returns the value of attribute acts_as_set.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def acts_as_set @acts_as_set end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def class_name @class_name end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def @options end |
#primary_key ⇒ Object (readonly)
Returns the value of attribute primary_key.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def primary_key @primary_key end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/jsonapi/association.rb', line 3 def type @type end |