Class: Geewiz::VarCache

Inherits:
Object
  • Object
show all
Defined in:
lib/geewiz/var_cache.rb

Overview

VarCache is responsible for caching variables and interacting with Geewiz to store variables.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ VarCache

Returns a new instance of VarCache.



4
5
6
7
# File 'lib/geewiz/var_cache.rb', line 4

def initialize(client)
  @client = client
  @vars = {}
end

Instance Method Details

#[](name) ⇒ Object



9
# File 'lib/geewiz/var_cache.rb', line 9

def [](name) = @vars[name.to_s]

#[]=(*args) ⇒ Object



11
12
13
# File 'lib/geewiz/var_cache.rb', line 11

def []=(*args)
  @client.var(*args)
end

#store(name, value) ⇒ Object



15
16
17
# File 'lib/geewiz/var_cache.rb', line 15

def store(name, value)
  @vars[name.to_s] = value
end