module Puppet::Network::FormatHandler::ClassMethods

Public Instance Methods

convert_from(format, data) click to toggle source
# File lib/puppet/network/format_handler.rb, line 107
def convert_from(format, data)
  format_handler.protected_format(format).intern(self, data)
end
convert_from_multiple(format, data) click to toggle source
# File lib/puppet/network/format_handler.rb, line 111
def convert_from_multiple(format, data)
  format_handler.protected_format(format).intern_multiple(self, data)
end
default_format() click to toggle source
# File lib/puppet/network/format_handler.rb, line 119
def default_format
  supported_formats[0]
end
format_handler() click to toggle source
# File lib/puppet/network/format_handler.rb, line 103
def format_handler
  Puppet::Network::FormatHandler
end
render_multiple(format, instances) click to toggle source
# File lib/puppet/network/format_handler.rb, line 115
def render_multiple(format, instances)
  format_handler.protected_format(format).render_multiple(instances)
end
support_format?(name) click to toggle source
# File lib/puppet/network/format_handler.rb, line 123
def support_format?(name)
  Puppet::Network::FormatHandler.format(name).supported?(self)
end
supported_formats() click to toggle source
# File lib/puppet/network/format_handler.rb, line 127
def supported_formats
  result = format_handler.formats.collect { |f| format_handler.format(f) }.find_all { |f| f.supported?(self) }.collect { |f| f.name }.sort do |a, b|
    # It's an inverse sort -- higher weight formats go first.
    format_handler.format(b).weight <=> format_handler.format(a).weight
  end

  result = put_preferred_format_first(result)

  Puppet.debug "#{friendly_name} supports formats: #{result.map{ |f| f.to_s }.sort.join(' ')}; using #{result.first}"

  result
end