Class: RubyUnits::Unit::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_units/cache.rb

Class Method Summary collapse

Class Method Details

.clearObject



14
15
16
17
18
# File 'lib/ruby_units/cache.rb', line 14

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

.get(key = nil) ⇒ Object



6
7
8
# File 'lib/ruby_units/cache.rb', line 6

def self.get(key = nil)
  key.nil? ? @@cached_units : @@cached_units[key]
end

.set(key, value) ⇒ Object



10
11
12
# File 'lib/ruby_units/cache.rb', line 10

def self.set(key, value)
  @@cached_units[key] = value
end