module Middleman::Util
def self.extract_response_text(response)
-
(String)
- The whole response as a string.
Parameters:
-
response
() -- The response from #call
def self.extract_response_text(response) case(response) when String response when Array response.join when Rack::Response response.body.join when Rack::File File.read(response.path) else response.to_s end end
def self.normalize_path(path)
-
(String)
-
Parameters:
-
path
(String
) --
def self.normalize_path(path) # The tr call works around a bug in Ruby's Unicode handling path.sub(/^\//, "").tr('','') end
def self.recursively_enhance(data)
-
(Thor::CoreExt::HashWithIndifferentAccess)
-
Parameters:
-
data
(Hash
) -- Normal hash
Other tags:
- Private: -
def self.recursively_enhance(data) if data.is_a? Hash data = ::Thor::CoreExt::HashWithIndifferentAccess.new(data) data.each do |key, val| data[key] = recursively_enhance(val) end data elsif data.is_a? Array data.each_with_index do |val, i| data[i] = recursively_enhance(val) end data else data end end