Class: ExpressionEngine::Preference
- Inherits:
-
Object
- Object
- ExpressionEngine::Preference
- Includes:
- Enumerable
- Defined in:
- lib/vendor/preference.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(serialized_data) ⇒ Preference
constructor
A new instance of Preference.
- #to_s ⇒ Object
Constructor Details
#initialize(serialized_data) ⇒ Preference
9 10 11 |
# File 'lib/vendor/preference.rb', line 9 def initialize(serialized_data) @data = PHP.unserialize(serialized_data).symbolize_keys rescue [] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/vendor/preference.rb', line 7 def data @data end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/vendor/preference.rb', line 13 def [](key) @data[key] rescue nil end |
#[]=(key, value) ⇒ Object
17 18 19 |
# File 'lib/vendor/preference.rb', line 17 def []=(key, value) @data[key] = value rescue nil end |
#each(&block) ⇒ Object
21 22 23 |
# File 'lib/vendor/preference.rb', line 21 def each(&block) @data.each(&block) rescue nil end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/vendor/preference.rb', line 25 def to_s PHP.serialize(@data.stringify_keys) rescue nil end |