Class: Puppet::Pops::Serialization::JSON::Writer Private

Inherits:
AbstractWriter show all
Defined in:
lib/puppet/pops/serialization/json.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A Writer that writes output in JSON format

Instance Method Summary collapse

Methods inherited from AbstractWriter

#finish, #inspect, #register_type, #register_types, #supports_binary?, #to_s, #write, #write_tpl, #write_tpl_qname

Constructor Details

#initialize(io, options = {}) ⇒ Writer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Writer.



14
15
16
# File 'lib/puppet/pops/serialization/json.rb', line 14

def initialize(io, options = {})
  super(Packer.new(io, options), options)
end

Instance Method Details

#build_payload {|@packer| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields:



33
34
35
# File 'lib/puppet/pops/serialization/json.rb', line 33

def build_payload
  yield(@packer)
end

#clear_ioObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Clear the underlying io stream but does not clear tabulation cache Specifically designed to enable tabulation to span more than one separately deserialized object.



21
22
23
# File 'lib/puppet/pops/serialization/json.rb', line 21

def clear_io
  @packer.clear_io
end

#extension_packerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/puppet/pops/serialization/json.rb', line 25

def extension_packer
  @packer
end

#packerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/puppet/pops/serialization/json.rb', line 29

def packer
  @packer
end

#to_aObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/puppet/pops/serialization/json.rb', line 37

def to_a
  @packer.to_a
end

#to_jsonObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/puppet/pops/serialization/json.rb', line 41

def to_json
  @packer.to_json
end