Method: PSON::Pure::Generator::State#initialize

Defined in:
lib/puppet/external/pson/pure/generator.rb

#initialize(opts = {}) ⇒ State

Instantiates a new State object, configured by opts.

opts can have the following keys:

  • indent: a string used to indent levels (default: ”),

  • space: a string that is put after, a : or , delimiter (default: ”),

  • space_before: a string that is put before a : pair delimiter (default: ”),

  • object_nl: a string that is put at the end of a PSON object (default: ”),

  • array_nl: a string that is put at the end of a PSON array (default: ”),

  • check_circular: true if checking for circular data structures should be done (the default), false otherwise.

  • check_circular: true if checking for circular data structures should be done, false (the default) otherwise.

  • allow_nan: true if NaN, Infinity, and -Infinity should be generated, otherwise an exception is thrown, if these values are encountered. This options defaults to false.



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/puppet/external/pson/pure/generator.rb', line 94

def initialize(opts = {})
  @seen = {}
  @indent         = ''
  @space          = ''
  @space_before   = ''
  @object_nl      = ''
  @array_nl       = ''
  @check_circular = true
  @allow_nan      = false
  configure opts
end