Class: ActiveRecord::Coders::Serializers::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Coders::Serializers::Base
- Defined in:
- lib/active_record/coders/serializers/base.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.dump ⇒ Object
Returns the value of attribute dump.
-
.load ⇒ Object
Returns the value of attribute load.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #dump(data) ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #load(data) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/active_record/coders/serializers/base.rb', line 13 def initialize( = {}) = end |
Class Attribute Details
.dump ⇒ Object
Returns the value of attribute dump.
4 5 6 |
# File 'lib/active_record/coders/serializers/base.rb', line 4 def dump @dump end |
.load ⇒ Object
Returns the value of attribute load.
4 5 6 |
# File 'lib/active_record/coders/serializers/base.rb', line 4 def load @load end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/active_record/coders/serializers/base.rb', line 11 def end |
Class Method Details
.serialize_with {|_self| ... } ⇒ Object
6 7 8 |
# File 'lib/active_record/coders/serializers/base.rb', line 6 def serialize_with yield self end |
Instance Method Details
#dump(data) ⇒ Object
23 24 25 26 27 |
# File 'lib/active_record/coders/serializers/base.rb', line 23 def dump(data) self.class.dump.call(data, ) rescue String.new end |
#load(data) ⇒ Object
17 18 19 20 21 |
# File 'lib/active_record/coders/serializers/base.rb', line 17 def load(data) self.class.load.call(data, ) rescue nil end |