Sha256: 1f90133688fc2c5b44d7d6f99d7e3d4dd2575c8b2627ef84f67e30877a8de05b

Contents?: true

Size: 549 Bytes

Versions: 33

Compression:

Stored size: 549 Bytes

Contents

# encoding: utf-8

module Mutant
  # An AST cache
  class Cache
    # This is explicitly empty! Ask me if you are interested in reasons :D
    include Equalizer.new

    # Initialize object
    #
    # @return [undefined]
    #
    # @api private
    #
    def initialize
      @cache = {}
    end

    # Return node for file
    #
    # @return [AST::Node]
    #
    # @api private
    #
    def parse(path)
      @cache.fetch(path) do
        @cache[path] = Parser::CurrentRuby.parse(File.read(path))
      end
    end

  end # Cache
end # Mutant

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
mutant-0.5.19 lib/mutant/cache.rb
mutant-0.5.18 lib/mutant/cache.rb
mutant-0.5.17 lib/mutant/cache.rb
mutant-0.5.16 lib/mutant/cache.rb
mutant-0.5.15 lib/mutant/cache.rb
mutant-0.5.14 lib/mutant/cache.rb
mutant-0.5.13 lib/mutant/cache.rb
mutant-0.5.12 lib/mutant/cache.rb
mutant-0.5.11 lib/mutant/cache.rb
mutant-0.5.10 lib/mutant/cache.rb
mutant-0.5.9 lib/mutant/cache.rb
mutant-0.5.8 lib/mutant/cache.rb
mutant-0.5.7 lib/mutant/cache.rb
mutant-0.5.6 lib/mutant/cache.rb
mutant-0.5.5 lib/mutant/cache.rb
mutant-0.5.4 lib/mutant/cache.rb
mutant-0.5.3 lib/mutant/cache.rb
mutant-0.5.2 lib/mutant/cache.rb
mutant-0.5.1 lib/mutant/cache.rb
mutant-0.5.0 lib/mutant/cache.rb