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.



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

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:



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

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.



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

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.



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

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.



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

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.



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

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.



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

def to_json
  @packer.to_json
end