module Puppet::Network::FormatSupport

Provides network serialization support when included @api public

Public Class Methods

included(klass) click to toggle source
  # File lib/puppet/network/format_support.rb
7 def self.included(klass)
8   klass.extend(ClassMethods)
9 end

Public Instance Methods

mime(format = nil) click to toggle source
    # File lib/puppet/network/format_support.rb
118 def mime(format = nil)
119   format ||= self.class.default_format
120 
121   self.class.get_format(format).mime
122 rescue => err
123   #TRANSLATORS "mime" is a function name and should not be translated
124   raise Puppet::Network::FormatHandler::FormatError, _("Could not mime to %{format}: %{err}") % { format: format, err: err }, err.backtrace
125 end
render(format = nil) click to toggle source
    # File lib/puppet/network/format_support.rb
109 def render(format = nil)
110   format ||= self.class.default_format
111 
112   self.class.get_format(format).render(self)
113 rescue => err
114   #TRANSLATORS "render" is a function name and should not be translated
115   raise Puppet::Network::FormatHandler::FormatError, _("Could not render to %{format}: %{err}") % { format: format, err: err }, err.backtrace
116 end
support_format?(name) click to toggle source
    # File lib/puppet/network/format_support.rb
127 def support_format?(name)
128   self.class.support_format?(name)
129 end
to_json(*args) click to toggle source
    # File lib/puppet/network/format_support.rb
105 def to_json(*args)
106   Puppet::Util::Json.dump(to_data_hash, *args)
107 end
to_msgpack(*args) click to toggle source
   # File lib/puppet/network/format_support.rb
96 def to_msgpack(*args)
97   to_data_hash.to_msgpack(*args)
98 end
to_pson(*args) click to toggle source

@deprecated, use to_json

    # File lib/puppet/network/format_support.rb
101 def to_pson(*args)
102   to_data_hash.to_pson(*args)
103 end