Class: Yoda::Store::Query::Associators::AssociateMethods
- Inherits:
-
Object
- Object
- Yoda::Store::Query::Associators::AssociateMethods
- Defined in:
- lib/yoda/store/query/associators/associate_methods.rb
Instance Attribute Summary collapse
- #registry ⇒ Registry readonly
Instance Method Summary collapse
- #associate(obj) ⇒ Object
-
#initialize(registry) ⇒ AssociateMethods
constructor
A new instance of AssociateMethods.
Constructor Details
#initialize(registry) ⇒ AssociateMethods
Returns a new instance of AssociateMethods.
10 11 12 |
# File 'lib/yoda/store/query/associators/associate_methods.rb', line 10 def initialize(registry) @registry = registry end |
Instance Attribute Details
#registry ⇒ Registry (readonly)
7 8 9 |
# File 'lib/yoda/store/query/associators/associate_methods.rb', line 7 def registry @registry end |
Instance Method Details
#associate(obj) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yoda/store/query/associators/associate_methods.rb', line 15 def associate(obj) if obj.is_a?(Objects::NamespaceObject) AssociateMethods.new(registry).associate(obj) obj.methods = Enumerator.new do |yielder| name_set = Set.new obj.ancestors.each do |ancestor| ancestor.instance_method_addresses.each do |method_address| method_name = Objects::MethodObject.name_of_path(method_address) next name_set.has_key?(method_name) name_set.add(method_name) if el = registry.find(method_address) yielder << el end end end end end end |