# File lib/hiera/filecache.rb, line 50
    def read_file(path, expected_type = Object)
      if stale?(path)
        data = File.read(path)
        @cache[path][:data] = block_given? ? yield(data) : data

        if !@cache[path][:data].is_a?(expected_type)
          raise TypeError, "Data retrieved from #{path} is #{data.class} not #{expected_type}"
        end
      end

      @cache[path][:data]
    end