Class: Puppet::Settings::HttpExtraHeadersSetting

Inherits:
BaseSetting show all
Defined in:
lib/puppet/settings/http_extra_headers_setting.rb

Constant Summary

Constants inherited from BaseSetting

BaseSetting::HOOK_TYPES

Instance Attribute Summary

Attributes inherited from BaseSetting

#call_hook, #default, #deprecated, #desc, #name, #section, #short

Instance Method Summary collapse

Methods inherited from BaseSetting

#allowed_on_commandline?, available_call_hook_values, #call_hook_on_define?, #call_hook_on_initialize?, #completely_deprecated?, #deprecated?, #getopt_args, #has_hook?, #hook=, #initialize, #inspect, #iscreated, #iscreated?, #optparse_args, #print, #set_meta, #to_config, #value

Constructor Details

This class inherits a constructor from Puppet::Settings::BaseSetting

Instance Method Details

#munge(headers) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/puppet/settings/http_extra_headers_setting.rb', line 8

def munge(headers)
  return headers if headers.is_a?(Hash)

  headers = headers.split(/\s*,\s*/) if headers.is_a?(String)

  raise ArgumentError, _("Expected an Array, String, or Hash, got a %{klass}") % { klass: headers.class } unless headers.is_a?(Array)

  headers.map! { |header|
    case header
    when String
      header.split(':')
    when Array
      header
    else
      raise ArgumentError, _("Expected an Array or String, got a %{klass}") % { klass: header.class }
    end
  }
end

#typeObject



4
5
6
# File 'lib/puppet/settings/http_extra_headers_setting.rb', line 4

def type
  :http_extra_headers
end