Class: JsonApiModel::Associations::Base
- Inherits:
-
Object
- Object
- JsonApiModel::Associations::Base
- Defined in:
- lib/json_api_model/associations/base.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
-
#opts ⇒ Object
Returns the value of attribute opts.
Instance Method Summary collapse
- #fetch(instance) ⇒ Object
-
#initialize(base_class, name, opts = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(base_class, name, opts = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 |
# File 'lib/json_api_model/associations/base.rb', line 7 def initialize( base_class, name, opts = {} ) self.name = name self.opts = opts self.key = idify( base_class ) sanitize_opts( base_class ) end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/json_api_model/associations/base.rb', line 5 def key @key end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/json_api_model/associations/base.rb', line 5 def name @name end |
#opts ⇒ Object
Returns the value of attribute opts.
5 6 7 |
# File 'lib/json_api_model/associations/base.rb', line 5 def opts @opts end |
Instance Method Details
#fetch(instance) ⇒ Object
15 16 17 |
# File 'lib/json_api_model/associations/base.rb', line 15 def fetch( instance ) process klass.send( action, query( instance ) ) end |