Module: SourceHelper

Included in:
GroupDelegatorInstances, GroupDelegatorKlasses
Defined in:
lib/group_delegator/source_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set_sources_data(proxied_objs) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/group_delegator/source_helper.rb', line 2

def self.set_sources_data(proxied_objs)
  source_obj_methods = {} #map of all methods to the objects that use them
  proxied_objs.each do |proxied_obj|
    proxied_obj.methods.each do |proxy_method|
      source_obj_methods[proxy_method] ||= [proxied_obj]
      source_obj_methods[proxy_method] << proxied_obj
    end
  end
  {:source_methods => source_obj_methods, :source_objs => proxied_objs}
end

Instance Method Details

#__set_sources_data(proxied_objs) ⇒ Object



13
14
15
16
# File 'lib/group_delegator/source_helper.rb', line 13

def __set_sources_data(proxied_objs)
  raise "No source instances set" unless proxied_objs.size > 0
  SourceHelper.set_sources_data(proxied_objs)
end