Sha256: b7b275da45e8ee22827463562f800156a9b00cbd2387b7b649b1501573cd119c

Contents?: true

Size: 351 Bytes

Versions: 4

Compression:

Stored size: 351 Bytes

Contents

class RubyUnits::Unit < Numeric
  @@cached_units = {}
  
  class Cache
    def self.get(key = nil)
      key.nil? ? @@cached_units : @@cached_units[key]
    end
  
    def self.set(key, value)
      @@cached_units[key] = value
    end

    def self.clear
      @@cached_units = {}
      @@base_unit_cache = {}
      Unit.new(1)
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-units-2.0.1 lib/ruby_units/cache.rb
ruby-units-2.0.0 lib/ruby_units/cache.rb
ruby-units-1.4.5 lib/ruby_units/cache.rb
ruby-units-1.4.4 lib/ruby_units/cache.rb