From 7f94ea0c30bee85c0eecbd4ccb4c8e7efb3889bb Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 21 Apr 2014 14:48:09 -0700 Subject: Add simple getter/setter methods to Store. --- core/config.rb | 8 ++++++++ core/store.rb | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'core') 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] -- cgit v1.2.3-70-g09d2