Method: Inch::CodeObject::Proxy.for

Defined in:
lib/inch/code_object/proxy.rb

.for(code_object) ⇒ CodeObject::Proxy::Base

Returns a Proxy object for the given code_object



12
13
14
15
16
17
18
19
20
21
# File 'lib/inch/code_object/proxy.rb', line 12

def for(code_object)
  @cache ||= {}
  if proxy_object = @cache[cache_key(code_object)]
    proxy_object
  else
    attributes = Converter.to_hash(code_object)
    proxy_object = class_for(code_object).new(attributes)
    @cache[cache_key(code_object)] = proxy_object
  end
end