Sha256: 3d6b730d5c49918d5eeebef7a11fee0c90a6080da394a37f542b1e558aa2ff80

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

require 'simple_xurrency/currency_convertible'
require 'core_ext/numeric'

class SimpleXurrency
  class << self
    attr_accessor :key
    
    def cache_enabled?
      if @cache_enabled.nil?
        @cache_enabled = true
      end
      
      @cache_enabled
    end
    
    def enable_cache
      @cache_enabled = true
    end
    
    def disable_cache
      @cache_enabled = false
    end
    
    def cache_get(key)
      ret = nil
  
      if @cache.is_a?(Hash)
        ret = @cache[key]
      end
      
      ret
    end
    
    def cache_add(key, value)
      if !@cache.is_a?(Hash)
        @cache = Hash.new
      end
  
      @cache[key] = value
    end
    
    def cache_flush
      @cache = Hash.new
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
simple_xurrency_buntine-1.1.2 lib/simple_xurrency.rb
simple_xurrency-1.1.2 lib/simple_xurrency.rb