Module: PSON::Pure::Generator::GeneratorMethods::Hash

Defined in:
lib/octocatalog-diff/external/pson/pure/generator.rb

Instance Method Summary collapse

Instance Method Details

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

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



208
209
210
211
212
213
214
215
216
# File 'lib/octocatalog-diff/external/pson/pure/generator.rb', line 208

def to_pson(state = nil, depth = 0, *)
  if state
    state = PSON.state.from_state(state)
    state.check_max_nesting(depth)
    pson_check_circular(state) { pson_transform(state, depth) }
  else
    pson_transform(state, depth)
  end
end