module Session::Storage
Public Instance Methods
current()
click to toggle source
# File lib/session/storage.rb, line 32 def current new id: store&.[](store_key) end
current=(v)
click to toggle source
# File lib/session/storage.rb, line 36 def current=(v) store&.[]=(store_key, v&.id) end
destroy()
click to toggle source
# File lib/session/storage.rb, line 15 def destroy self.class.current = nil end
persisted?()
click to toggle source
# File lib/session/storage.rb, line 19 def persisted? self.class.current == self end
save()
click to toggle source
# File lib/session/storage.rb, line 6 def save if validate self.class.current = self return true else return false end end
store()
click to toggle source
# File lib/session/storage.rb, line 28 def store @store ||= {} end
store_key()
click to toggle source
# File lib/session/storage.rb, line 42 def store_key :"#{self.to_s.underscore.sub '/', '_'}_#{id_attribute}" end