Class: RestModel::Embeddable
- Inherits:
-
Association
- Object
- Key
- Association
- RestModel::Embeddable
- Defined in:
- lib/rest_model/key/embeddable.rb,
lib/rest_model/key/embeddable/sender.rb,
lib/rest_model/key/embeddable/builder.rb,
lib/rest_model/key/embeddable/response.rb,
lib/rest_model/key/embeddable/retriever.rb
Defined Under Namespace
Modules: Builder, Response, Retriever, Sender
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
Attributes inherited from Association
Attributes inherited from Key
#model, #name, #options, #summarize
Instance Method Summary collapse
- #from_hash(attrs, resource = nil) ⇒ Object
-
#initialize(name, options = {}) ⇒ Embeddable
constructor
A new instance of Embeddable.
- #raw? ⇒ Boolean
Methods included from Response
#build_links, #resource, #resource_keys, #summarize?
Methods included from Retriever
#digg, #from_source, #handle_fields
Methods included from Sender
Methods inherited from Association
#default_class_name, #many?, #one?, #resource_class
Methods inherited from Key
#convert_input_keys, #present?, #relation?, #root_path?, #source_path, #visible?
Constructor Details
#initialize(name, options = {}) ⇒ Embeddable
Returns a new instance of Embeddable.
12 13 14 15 16 17 18 19 |
# File 'lib/rest_model/key/embeddable.rb', line 12 def initialize(name, = {}) super if fields = [:fields] @class_name = :array @fields = fields end end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
10 11 12 |
# File 'lib/rest_model/key/embeddable.rb', line 10 def fields @fields end |
Instance Method Details
#from_hash(attrs, resource = nil) ⇒ Object
25 26 27 |
# File 'lib/rest_model/key/embeddable.rb', line 25 def from_hash(attrs, resource = nil) raw? ? attrs : super end |
#raw? ⇒ Boolean
21 22 23 |
# File 'lib/rest_model/key/embeddable.rb', line 21 def raw? %w(Hash Array).include?(@class_name.to_s.camelize) end |