Class: Unit::Cache

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

Class Method Summary collapse

Class Method Details

.clearObject



13
14
15
16
17
# File 'lib/rails_units/cache.rb', line 13

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

.get(key = nil) ⇒ Object



5
6
7
# File 'lib/rails_units/cache.rb', line 5

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

.set(key, value) ⇒ Object



9
10
11
# File 'lib/rails_units/cache.rb', line 9

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