class Telepath::Storage
Constants
- DEFAULT_FILE
- DEFAULT_PATH
- DEFAULT_TYPE
Public Instance Methods
file()
click to toggle source
# File lib/telepath/storage.rb, line 41 def file @file ||= get :file end
location()
click to toggle source
# File lib/telepath/storage.rb, line 25 def location if path.exist? then path.join file else raise <<-ERRMSG Create or change the storage path for Telepath. Current: `#{path}' Environment Variable Name: `#{PATH_VAR}' ERRMSG end end
path()
click to toggle source
# File lib/telepath/storage.rb, line 37 def path @path ||= Pathname.new(get :path).expand_path end
ready?()
click to toggle source
# File lib/telepath/storage.rb, line 19 def ready? !store.adapter.backend.closed? end
stack()
click to toggle source
# File lib/telepath/storage.rb, line 15 def stack store['stack'] || Array.new end
store()
click to toggle source
# File lib/telepath/storage.rb, line 11 def store @store ||= create_store end
type()
click to toggle source
# File lib/telepath/storage.rb, line 45 def type @type ||= get :type end
Protected Instance Methods
create_store()
click to toggle source
# File lib/telepath/storage.rb, line 51 def create_store Moneta.new type, file: location end
get(name)
click to toggle source
# File lib/telepath/storage.rb, line 55 def get name env_name = "TELEPATH_#{name.to_s.upcase}" const_name = "DEFAULT_#{name.to_s.upcase}" value = ENV[env_name] value && !value.empty? && value || self.class.const_get(const_name) end