class Castle::Headers::Format

formats header name

Public Class Methods

call(header) click to toggle source

@param header [String] @return [String]

# File lib/castle/headers/format.rb, line 10
def call(header)
  format(header.to_s.gsub(/^HTTP(?:_|-)/i, ''))
end

Private Class Methods

format(header) click to toggle source

@param header [String] @return [String]

# File lib/castle/headers/format.rb, line 18
def format(header)
  header.split(/_|-/).map(&:capitalize).join('-')
end