Module: Fiveruns::JSON::Pure::Generator::GeneratorMethods::Hash

Defined in:
lib/fiveruns/json/generator.rb

Instance Method Summary collapse

Instance Method Details

#to_fjson(state = nil, depth = 0) ⇒ Object

Returns a FiverunsJSON string containing a FiverunsJSON object, that is unparsed from this Hash instance. state is a FiverunsJSON::State object, that can also be used to configure the produced FiverunsJSON string output further. depth is used to find out nesting depth, to indent accordingly.



212
213
214
215
216
217
218
219
220
# File 'lib/fiveruns/json/generator.rb', line 212

def to_fjson(state = nil, depth = 0, *)
  if state
    state = ::Fiveruns::JSON.state.from_state(state)
    state.check_max_nesting(depth)
    fjson_check_circular(state) { fjson_transform(state, depth) }
  else
    fjson_transform(state, depth)
  end
end