Sha256: 8b9b3cc6aa5f4015d01d11f4763a77710f7fd038f75f68725230eac7e9711833

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

require 'reek/code_context'

module Reek
  class BlockContext < CodeContext

    def initialize(outer, exp)
      super
      @parameters = []
      @local_variables = []
      @name = Name.new('block')
    end

    def inside_a_block?
      true
    end

    def has_parameter(name)
      @parameters.include?(name) or @outer.has_parameter(name)
    end

    def nested_block?
      @outer.inside_a_block?
    end
    
    def record_parameter(sym)
      @parameters << Name.new(sym)
    end

    def outer_name
      "#{@outer.outer_name}#{@name}/"
    end
    
    def variable_names
      @parameters + @local_variables
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
kevinrutherford-reek-0.3.1.4 lib/reek/block_context.rb
kevinrutherford-reek-0.3.1.5 lib/reek/block_context.rb
kevinrutherford-reek-0.3.1.6 lib/reek/block_context.rb
kevinrutherford-reek-1.0.0 lib/reek/block_context.rb
kevinrutherford-reek-1.0.1 lib/reek/block_context.rb
reek-1.0.0 lib/reek/block_context.rb