Sha256: 70115171781061ade701ce46e7145eb192e51b6f828c1abf7aad7c9a23e93135
Contents?: true
Size: 1.06 KB
Versions: 14
Compression:
Stored size: 1.06 KB
Contents
class Module def const_or_nil(sym) const_defined?(sym) ? const_get(sym) : nil end end module Reek # # 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. # class CodeContext attr_reader :name def initialize(outer, exp) @outer = outer @exp = exp @myself = nil end def matches?(strings) me = @name.to_s strings.any? do |str| re = /#{str}/ re === me or re === self.to_s end end # # Bounces messages up the context tree to the first enclosing context # that knows how to deal with the request. # def method_missing(method, *args) @outer.send(method, *args) end def num_methods 0 end def outer_name "#{@name}/" end def to_s "#{@outer.outer_name}#{@name}" end end end
Version data entries
14 entries across 14 versions & 2 rubygems