Module: Seahorse::Util

Defined in:
aws-sdk-core/lib/seahorse/util.rb

Class Method Summary collapse

Class Method Details

.load_json(path) ⇒ Object


27
28
29
# File 'aws-sdk-core/lib/seahorse/util.rb', line 27

def load_json(path)
  MultiJson.load(File.open(path, 'r', encoding: 'UTF-8') { |f| f.read })
end

.underscore(string) ⇒ String


15
16
17
18
19
20
21
# File 'aws-sdk-core/lib/seahorse/util.rb', line 15

def underscore(string)
  string.
    gsub(@irregular_regex) { |word| '_' + @irregular_inflections[word] }.
    gsub(/([A-Z0-9]+)([A-Z][a-z])/, '\1_\2').
    scan(/[a-z0-9]+|\d+|[A-Z0-9]+[a-z]*/).
    join('_').downcase
end

.uri_escape(string) ⇒ Object


23
24
25
# File 'aws-sdk-core/lib/seahorse/util.rb', line 23

def uri_escape(string)
  CGI::escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~')
end