Sha256: 82e229244427937318e7829e432c7fbe52469316840f74de5688981a660b7d89

Contents?: true

Size: 486 Bytes

Versions: 1

Compression:

Stored size: 486 Bytes

Contents

# frozen_string_literal: true

module SnakeEyes
  module Memoization
    def self.included(base)
      base.class_eval do
        private

        def params_from_cache(key)
          previous_params[key]
        end

        def params_in_cache?(key)
          previous_params.key?(key)
        end

        def cache!(key, value)
          previous_params[key] = value
        end

        def previous_params
          @previous_params ||= {}
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
snake-eyes-2.0.0 lib/snake_eyes/memoization.rb