Class: Ubiquitously::Storage::ActiveRecord
- Defined in:
- lib/ubiquitously/support/storage.rb
Instance Attribute Summary collapse
-
#cookies_attribute ⇒ Object
Returns the value of attribute cookies_attribute.
-
#credentials_attribute ⇒ Object
Returns the value of attribute credentials_attribute.
-
#record ⇒ Object
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record, cookies_attribute, credentials_attribute) ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
- #load ⇒ Object
- #save(cookies, credentials) ⇒ Object
Constructor Details
#initialize(record, cookies_attribute, credentials_attribute) ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
50 51 52 53 54 |
# File 'lib/ubiquitously/support/storage.rb', line 50 def initialize(record, , credentials_attribute) self.record = record self. = self.credentials_attribute = credentials_attribute end |
Instance Attribute Details
#cookies_attribute ⇒ Object
Returns the value of attribute cookies_attribute.
48 49 50 |
# File 'lib/ubiquitously/support/storage.rb', line 48 def @cookies_attribute end |
#credentials_attribute ⇒ Object
Returns the value of attribute credentials_attribute.
48 49 50 |
# File 'lib/ubiquitously/support/storage.rb', line 48 def credentials_attribute @credentials_attribute end |
#record ⇒ Object
Returns the value of attribute record.
48 49 50 |
# File 'lib/ubiquitously/support/storage.rb', line 48 def record @record end |
Instance Method Details
#load ⇒ Object
63 64 65 66 67 68 |
# File 'lib/ubiquitously/support/storage.rb', line 63 def load { :cookies => record.read_attribute(), :credentials => record.read_attribute(credentials_attribute) } end |
#save(cookies, credentials) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/ubiquitously/support/storage.rb', line 56 def save(, credentials) record.update_attributes( => , credentials_attribute => credentials ) end |