Class: OldApiResource::Associations::MultiObjectProxy
- Inherits:
-
AssociationProxy
- Object
- AssociationProxy
- OldApiResource::Associations::MultiObjectProxy
- Includes:
- Enumerable
- Defined in:
- lib/old_api_resource/associations/multi_object_proxy.rb
Instance Attribute Summary
Attributes inherited from AssociationProxy
#klass, #loaded, #remote_path, #scopes, #times_loaded
Instance Method Summary collapse
- #all ⇒ Object
- #each(*args, &block) ⇒ Object
-
#internal_object ⇒ Object
force a load when calling this method.
- #internal_object=(contents) ⇒ Object
- #serializable_hash(options) ⇒ Object
Methods inherited from AssociationProxy
#initialize, #inspect, #method_missing, #reload, #scope?, #to_s
Constructor Details
This class inherits a constructor from OldApiResource::Associations::AssociationProxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OldApiResource::Associations::AssociationProxy
Instance Method Details
#all ⇒ Object
11 12 13 |
# File 'lib/old_api_resource/associations/multi_object_proxy.rb', line 11 def all self.internal_object end |
#each(*args, &block) ⇒ Object
15 16 17 |
# File 'lib/old_api_resource/associations/multi_object_proxy.rb', line 15 def each(*args, &block) self.internal_object.each(*args, &block) end |
#internal_object ⇒ Object
force a load when calling this method
24 25 26 |
# File 'lib/old_api_resource/associations/multi_object_proxy.rb', line 24 def internal_object @internal_object ||= self.(:all, {}) end |
#internal_object=(contents) ⇒ Object
28 29 30 31 |
# File 'lib/old_api_resource/associations/multi_object_proxy.rb', line 28 def internal_object=(contents) return @internal_object = contents if contents.all?{|o| o.is_a?(self.klass)} return load(contents) end |
#serializable_hash(options) ⇒ Object
19 20 21 |
# File 'lib/old_api_resource/associations/multi_object_proxy.rb', line 19 def serializable_hash() self.internal_object.collect{|obj| obj.serializable_hash() } end |