aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-21 14:48:09 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-21 14:48:09 -0700
commit7f94ea0c30bee85c0eecbd4ccb4c8e7efb3889bb (patch)
treec3520d0727314bff2dbfac006743672f825f605d /core
parent211018e2f94c60fdf7a47b87cbcb07432f0fa25d (diff)
downloaddinobot-7f94ea0c30bee85c0eecbd4ccb4c8e7efb3889bb.tar.gz
dinobot-7f94ea0c30bee85c0eecbd4ccb4c8e7efb3889bb.tar.xz
Add simple getter/setter methods to Store.
Diffstat (limited to 'core')
-rw-r--r--core/config.rb8
-rw-r--r--core/store.rb8
2 files changed, 16 insertions, 0 deletions
diff --git a/core/config.rb b/core/config.rb
index 466e435..36511ed 100644
--- a/core/config.rb
+++ b/core/config.rb
@@ -20,6 +20,14 @@ module Dinobot
end
end
+ def [](key)
+ @data[key]
+ end
+
+ def []=(key, value)
+ @data[key] = value
+ end
+
def save
@store.save
end
diff --git a/core/store.rb b/core/store.rb
index ba49733..5e1cf67 100644
--- a/core/store.rb
+++ b/core/store.rb
@@ -14,6 +14,14 @@ module Dinobot
@data ||= Hash.new
end
+ def [](key)
+ @data[key]
+ end
+
+ def []=(key, value)
+ @data[key] = value
+ end
+
def read
@store.transaction(true) do
@data = @store[:data]