Sha256: fbd51bb5666c56b6901ea281c14d7b46ebd23e041cca844eb7c09da49e748563

Contents?: true

Size: 365 Bytes

Versions: 4

Compression:

Stored size: 365 Bytes

Contents

module Yoda
  module Model
    class Environment
      module WithCache
        # @param with_cache [Symbol]
        def with_cache(cache_name)
          cache_key = :"@#{cache_name}"
          return instance_variable_get(cache_key) if instance_variable_defined?(cache_key)
          instance_variable_set(cache_key, yield)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/model/environment/with_cache.rb
yoda-language-server-0.10.0 lib/yoda/model/environment/with_cache.rb
yoda-language-server-0.9.0 lib/yoda/model/environment/with_cache.rb
yoda-language-server-0.8.0 lib/yoda/model/environment/with_cache.rb