Class: ImplementsRelation

Inherits:
Relation show all
Defined in:
lib/exploration/implements_relation.rb

Instance Attribute Summary

Attributes inherited from Explorer

#resolve_strategy

Instance Method Summary collapse

Methods inherited from Relation

#each_by_type, #explore_entity_sexp, #get_name_and_namespace, #get_namespace

Instance Method Details

#each(sexp, context = nil, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/exploration/implements_relation.rb', line 4

def each sexp, context=nil, &block
  sexp.each_sexp do |child|
    # check if child is a call to include
    if child.first == :call && child.rest.rest.first == :include
      node = child.rest.rest.rest.first
      name, namespace, explored = get_name_and_namespace node
      block.call context, :implements, { name: name, type: :module, namespace: namespace }
    end
  end
end