module Puppet::Network::FormatSupport

Provides network serialization support when included @api public

Public Instance Methods

mime(format = nil) click to toggle source
# File lib/puppet/network/format_support.rb, line 103
def mime(format = nil)
  format ||= self.class.default_format

  self.class.get_format(format).mime
rescue => err
  raise Puppet::Network::FormatHandler::FormatError, "Could not mime to #{format}: #{err}", err.backtrace
end
render(format = nil) click to toggle source
# File lib/puppet/network/format_support.rb, line 95
def render(format = nil)
  format ||= self.class.default_format

  self.class.get_format(format).render(self)
rescue => err
  raise Puppet::Network::FormatHandler::FormatError, "Could not render to #{format}: #{err}", err.backtrace
end
support_format?(name) click to toggle source
# File lib/puppet/network/format_support.rb, line 111
def support_format?(name)
  self.class.support_format?(name)
end
to_msgpack(*args) click to toggle source
# File lib/puppet/network/format_support.rb, line 87
def to_msgpack(*args)
  to_data_hash.to_msgpack(*args)
end
to_pson(*args) click to toggle source
# File lib/puppet/network/format_support.rb, line 91
def to_pson(*args)
  to_data_hash.to_pson(*args)
end

Public Class Methods

included(klass) click to toggle source
# File lib/puppet/network/format_support.rb, line 6
def self.included(klass)
  klass.extend(ClassMethods)
end