Class: Hash

Inherits:
Object show all
Defined in:
lib/aws/s3/extensions.rb

Overview

:stopdoc:

Instance Method Summary collapse

Instance Method Details

#to_normalized_optionsObject



16
17
18
19
20
21
22
# File 'lib/aws/s3/extensions.rb', line 16

def to_normalized_options
  # Convert all option names to downcased strings, and replace underscores with hyphens
  inject({}) do |normalized_options, (name, value)|
    normalized_options[name.to_header] = value.to_s
    normalized_options
  end
end

#to_normalized_options!Object



24
25
26
# File 'lib/aws/s3/extensions.rb', line 24

def to_normalized_options!
  replace(to_normalized_options)
end

#to_query_string(include_question_mark = true) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/aws/s3/extensions.rb', line 5

def to_query_string(include_question_mark = true)
  query_string = ''
  unless empty?
    query_string << '?' if include_question_mark
    query_string << inject([]) do |params, (key, value)| 
      params << "#{key}=#{AWS::S3.escape_uri_component(value)}" 
    end.join('&')
  end
  query_string
end