Class: RubyLint::MethodCall::Include

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby-lint/method_call/include.rb

Overview

The Include class is used for evaluating the use of include and extend method calls.

Constant Summary

COPY_TYPES =

Hash containing the source and target definition types for both include and extend method calls.

{
  :include => {
    :const           => :const,
    :instance_method => :instance_method
  },
  :extend => {
    :const           => :const,
    :instance_method => :method
  }
}

Instance Attribute Summary

Attributes inherited from Base

#node, #vm

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RubyLint::MethodCall::Base

Instance Method Details

#evaluate(arguments, context, block = nil) ⇒ Object

See Also:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ruby-lint/method_call/include.rb', line 26

def evaluate(arguments, context, block = nil)
  node_name = node.children[1]

  arguments.each do |source|
    COPY_TYPES[node_name].each do |from, to|
      source.list(from).each do |definition|
        context.add(to, definition.name, definition)
      end
    end
  end
end