Module: Farce::Internal::ValueSerialization
- Included in:
- Abstract::Atom, Abstract::Counter, Abstract::Flag
- Defined in:
- lib/farce/integrations/bson.rb,
lib/farce/integrations/cbor.rb,
lib/farce/integrations/psych.rb,
lib/farce/integrations/msgpack.rb,
lib/farce/integrations/shared/to_json.rb,
lib/farce/integrations/active_support/value_serialization.rb
BSON Integration collapse
-
#as_extended_json(**options) ⇒ Object
Represent the current value as Extended JSON, forwarding BSON's format options.
-
#to_bson(buffer = ::BSON::ByteBuffer.new) ⇒ BSON::ByteBuffer
Serialize the current stored value using its BSON representation.
-
#to_bson_normalized_value ⇒ Object
Read the stored value once and normalize it for BSON encoding.
CBOR Integration collapse
-
#to_cbor(*arguments) ⇒ String, ...
Serialize the current value using its CBOR representation.
ActiveSupport Integration collapse
-
#as_json(options = nil) ⇒ Object?
Convert the current value using ActiveSupport's JSON conversion.
-
#to_msgpack(*arguments) ⇒ String, ::MessagePack::Packer
Serialize the current value as its primitive MessagePack equivalent.
JSON Integration collapse
-
#to_json(*arguments) ⇒ String
Serialize the current value as its primitive JSON equivalent.
Instance Method Details
#as_extended_json(**options) ⇒ Object
106 |
# File 'lib/farce/integrations/bson.rb', line 106 def as_extended_json(**) = value.as_extended_json(**) |
#as_json(options = nil) ⇒ Object?
This methods is only available if ActiveSupport has been loaded.
Convert the current value using ActiveSupport's JSON conversion.
15 |
# File 'lib/farce/integrations/active_support/value_serialization.rb', line 15 def as_json(...) = value.as_json(...) |
#to_bson(buffer = ::BSON::ByteBuffer.new) ⇒ BSON::ByteBuffer
This method is only available if BSON has been loaded.
Serialize the current stored value using its BSON representation. Use BSON::Document.new when embedding value wrappers in ordinary Ruby hashes.
94 |
# File 'lib/farce/integrations/bson.rb', line 94 def to_bson(buffer = ::BSON::ByteBuffer.new) = to_bson_normalized_value.to_bson(buffer) |
#to_bson_normalized_value ⇒ Object
This method is only available if BSON has been loaded.
Read the stored value once and normalize it for BSON encoding.
99 |
# File 'lib/farce/integrations/bson.rb', line 99 def to_bson_normalized_value = value.to_bson_normalized_value |
#to_cbor(*arguments) ⇒ String, ...
49 |
# File 'lib/farce/integrations/cbor.rb', line 49 def to_cbor(...) = value.to_cbor(...) |
#to_json(*arguments) ⇒ String
This method is only available if a supported JSON library has been loaded.
Serialize the current value as its primitive JSON equivalent.
40 |
# File 'lib/farce/integrations/shared/to_json.rb', line 40 def to_json(...) = value.to_json(...) |
#to_msgpack(*arguments) ⇒ String, ::MessagePack::Packer
This method is only available if MessagePack has been loaded.
Serialize the current value as its primitive MessagePack equivalent.
43 |
# File 'lib/farce/integrations/msgpack.rb', line 43 def to_msgpack(...) = value.to_msgpack(...) |