Class: Trello::AssociationProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/trello/association_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(association) ⇒ AssociationProxy

Returns a new instance of AssociationProxy.



12
13
14
15
# File 'lib/trello/association_proxy.rb', line 12

def initialize(association)
  @association = association
  Array(association.options[:extend]).each { |ext| proxy_extend(ext) }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/trello/association_proxy.rb', line 21

def method_missing(method, *args, &block)
  if target.respond_to? method
    target.send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#<<(*records) ⇒ Object



38
39
40
# File 'lib/trello/association_proxy.rb', line 38

def <<(*records)
  proxy_assocation.concat(records) && self
end

#===(other) ⇒ Object



29
30
31
# File 'lib/trello/association_proxy.rb', line 29

def ===(other)
  other === target
end

#proxy_assocationObject



17
18
19
# File 'lib/trello/association_proxy.rb', line 17

def proxy_assocation
  @association
end

#to_aryObject Also known as: to_a



33
34
35
# File 'lib/trello/association_proxy.rb', line 33

def to_ary
  proxy_assocation.dup
end