Class: MarkMapper::Plugins::Associations::Collection

Inherits:
Proxy
  • Object
show all
Defined in:
lib/mark_mapper/plugins/associations/collection.rb

Instance Attribute Summary

Attributes inherited from Proxy

#association, #proxy_owner, #target

Instance Method Summary collapse

Methods inherited from Proxy

#as_json, #blank?, #initialize, #inspect, #loaded, #loaded?, #nil?, #present?, #proxy_respond_to?, #reload, #replace, #respond_to?, #send, #to_json

Constructor Details

This class inherits a constructor from MarkMapper::Plugins::Associations::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MarkMapper::Plugins::Associations::Proxy

Instance Method Details

#include?(*args) ⇒ Boolean

Returns:


17
18
19
20
# File 'lib/mark_mapper/plugins/associations/collection.rb', line 17

def include?(*args)
  load_target
  target.include?(*args)
end

#resetObject


22
23
24
25
# File 'lib/mark_mapper/plugins/associations/collection.rb', line 22

def reset
  super
  target = []
end

#to_aryObject Also known as: to_a


6
7
8
9
10
11
12
13
# File 'lib/mark_mapper/plugins/associations/collection.rb', line 6

def to_ary
  load_target
  if target.is_a?(Array)
    target.to_ary
  else
    Array(target)
  end
end