Module: Treat::Proxies::Array

Includes:
Proxy
Defined in:
lib/treat/proxies/array.rb

Instance Method Summary collapse

Methods included from Proxy

#to_entity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/treat/proxies/array.rb', line 6

def method_missing(sym, *args, &block)
  if [:do, :apply].include?(sym) || 
    Treat::Workers.lookup(sym)
    map do |el|
      if el.is_a?(Treat::Entities::Entity)
        el.send(sym, *args)
      else
        el.to_entity.send(sym, *args)
      end
    end
  else
    super(sym, *args, &block)
  end
end