lib/splash/helpers.rb in prometheus-splash-0.7.0 vs lib/splash/helpers.rb in prometheus-splash-0.8.0
- old
+ new
@@ -250,11 +250,11 @@
#@!group Verifiers for application : FS and TCP/IP services
# check folder
# @return [Array] of Symbol with error type : [:inexistant,:mode,:owner,:group]
# @param [Hash] options
- # @option options [String] :path folder path (relative or absolute)
+ # @option options [String] :name folder path (relative or absolute)
# @option options [String] :mode String for OCTAL rights like "644", optionnal
# @option options [String] :owner file owner for folder, optionnal
# @option options [String] :group file group for folder, optionnal
def verify_folder(options ={})
res = Array::new
@@ -334,11 +334,10 @@
return false
end
end
#!@endgroup
-
def format_response(data, format)
response = case format
when 'application/json' then JSON.pretty_generate(data)
when 'text/x-yaml' then data.to_yaml
else JSON.pretty_generate(data)
@@ -353,8 +352,18 @@
'yml' => 'text/x-yaml'
}
return result[extension]
end
+ # check if unicode must be used with term ENV
+ # @return [Boolean]
+ def check_unicode_term
+ return false unless ENV.include? "TERM"
+ if ENV.values_at("LC_ALL","LC_CTYPE","LANG").compact.first.include?("UTF-8") and ENV.values_at('TERM').first.include? "xterm" then
+ return true
+ else
+ return false
+ end
+ end
end
end