Class: Elastic::Transport::Transport::Serializer::MultiJson
- Inherits:
-
Object
- Object
- Elastic::Transport::Transport::Serializer::MultiJson
- Includes:
- Base
- Defined in:
- lib/elastic/transport/transport/serializer/multi_json.rb
Overview
A default JSON serializer (using MultiJSON)
Instance Method Summary collapse
-
#dump(object, options = {}) ⇒ Object
Serialize a Hash to JSON string.
-
#load(string, options = {}) ⇒ Object
De-serialize a Hash from JSON string.
Methods included from Base
Instance Method Details
#dump(object, options = {}) ⇒ Object
Serialize a Hash to JSON string
49 50 51 52 53 54 55 |
# File 'lib/elastic/transport/transport/serializer/multi_json.rb', line 49 def dump(object, = {}) if deprecated_gem_version_loaded? ::MultiJson.dump(object, ) else ::MultiJSON.generate(object, ) end end |
#load(string, options = {}) ⇒ Object
De-serialize a Hash from JSON string
39 40 41 42 43 44 45 |
# File 'lib/elastic/transport/transport/serializer/multi_json.rb', line 39 def load(string, = {}) if deprecated_gem_version_loaded? ::MultiJson.load(string, ) else ::MultiJSON.parse(string, ) end end |