Parent

Class/Module Index [+]

Quicksearch

Reek::Core::CodeContext

Superclass for all types of source code context. Each instance represents a code element of some kind, and each provides behaviour relevant to that code element. CodeContexts form a tree in the same way the code does, with each context holding a reference to a unique outer context.

Attributes

config[R]
exp[R]

Public Class Methods

new(outer, exp) click to toggle source
# File lib/reek/core/code_context.rb, line 15
def initialize(outer, exp)
  @outer = outer
  @exp = exp
  @config = local_config
end

Public Instance Methods

each_node(type, ignoring, &blk) click to toggle source
# File lib/reek/core/code_context.rb, line 29
def each_node(type, ignoring, &blk)
  @exp.each_node(type, ignoring, &blk)
end
full_name() click to toggle source
# File lib/reek/core/code_context.rb, line 50
def full_name
  outer = @outer ? @outer.full_name : ''
  exp.full_name(outer)
end
local_config() click to toggle source
# File lib/reek/core/code_context.rb, line 55
def local_config
  return Hash.new if @exp.nil?
  config = Source::CodeComment.new(@exp.comments || '').config
  return config unless @outer
  @outer.config.deep_copy.adopt!(config)
  # no tests for this -----^
end
local_nodes(type, &blk) click to toggle source
# File lib/reek/core/code_context.rb, line 25
def local_nodes(type, &blk)
  each_node(type, [:class, :module], &blk)
end
matches?(candidates) click to toggle source
# File lib/reek/core/code_context.rb, line 33
def matches?(candidates)
  my_fq_name = full_name
  candidates.any? {|str| /#{str}/ === my_fq_name }
end
method_missing(method, *args) click to toggle source

Bounces messages up the context tree to the first enclosing context that knows how to deal with the request.

# File lib/reek/core/code_context.rb, line 42
def method_missing(method, *args)
  @outer.send(method, *args)
end
name() click to toggle source
# File lib/reek/core/code_context.rb, line 21
def name
  @exp.name
end
num_methods() click to toggle source
# File lib/reek/core/code_context.rb, line 46
def num_methods
  0
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.