Class: ElasticSearch::Encoding::JSON

Inherits:
Base
  • Object
show all
Defined in:
lib/elasticsearch/encoding/json.rb

Instance Method Summary collapse

Instance Method Details

#decode(string) ⇒ Object



13
14
15
# File 'lib/elasticsearch/encoding/json.rb', line 13

def decode(string)
  MultiJson.load(string)
end

#encode(object) ⇒ Object



9
10
11
# File 'lib/elasticsearch/encoding/json.rb', line 9

def encode(object)
  MultiJson.dump(object)
end

#is_encoded?(object) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/elasticsearch/encoding/json.rb', line 26

def is_encoded?(object)
  object.is_a?(String)
end