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 6 def self.included(klass) 7 klass.extend(ClassMethods) 8 end
Public Instance Methods
mime(format = nil)
click to toggle source
# File lib/puppet/network/format_support.rb 117 def mime(format = nil) 118 format ||= self.class.default_format 119 120 self.class.get_format(format).mime 121 rescue => err 122 #TRANSLATORS "mime" is a function name and should not be translated 123 raise Puppet::Network::FormatHandler::FormatError, _("Could not mime to %{format}: %{err}") % { format: format, err: err }, err.backtrace 124 end
render(format = nil)
click to toggle source
# File lib/puppet/network/format_support.rb 108 def render(format = nil) 109 format ||= self.class.default_format 110 111 self.class.get_format(format).render(self) 112 rescue => err 113 #TRANSLATORS "render" is a function name and should not be translated 114 raise Puppet::Network::FormatHandler::FormatError, _("Could not render to %{format}: %{err}") % { format: format, err: err }, err.backtrace 115 end
support_format?(name)
click to toggle source
# File lib/puppet/network/format_support.rb 126 def support_format?(name) 127 self.class.support_format?(name) 128 end
to_json(*args)
click to toggle source
# File lib/puppet/network/format_support.rb 104 def to_json(*args) 105 Puppet::Util::Json.dump(to_data_hash, *args) 106 end
to_msgpack(*args)
click to toggle source
# File lib/puppet/network/format_support.rb 95 def to_msgpack(*args) 96 to_data_hash.to_msgpack(*args) 97 end
to_pson(*args)
click to toggle source
@deprecated, use to_json
# File lib/puppet/network/format_support.rb 100 def to_pson(*args) 101 to_data_hash.to_pson(*args) 102 end