Class: Volt::Persistors::HttpCookiePersistor

Inherits:
Base
  • Object
show all
Defined in:
lib/volt/controllers/http_controller/http_cookie_persistor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#added, #async?, #auto_generate_id, #clear, #event_added, #event_removed, #loaded, #removed, #root_model

Constructor Details

#initialize(*args) ⇒ HttpCookiePersistor

Returns a new instance of HttpCookiePersistor.



8
9
10
11
12
# File 'lib/volt/controllers/http_controller/http_cookie_persistor.rb', line 8

def initialize(*args)
  super

  @changed_cookies = {}
end

Instance Attribute Details

#changed_cookiesObject (readonly)

Returns the value of attribute changed_cookies.



6
7
8
# File 'lib/volt/controllers/http_controller/http_cookie_persistor.rb', line 6

def changed_cookies
  @changed_cookies
end

Instance Method Details

#changed(attribute_name) ⇒ Object



14
15
16
17
18
19
# File 'lib/volt/controllers/http_controller/http_cookie_persistor.rb', line 14

def changed(attribute_name)
  value = @model.get(attribute_name)
  value = value.to_h if value.is_a?(Volt::Model)

  @changed_cookies[attribute_name] = value
end