Module: Fiveruns::JSON::Pure::Generator::GeneratorMethods::Array

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 array, that is unparsed from this Array 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.



266
267
268
269
270
271
272
273
274
# File 'lib/fiveruns/json/generator.rb', line 266

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