Class: Awsum::S3::Headers
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(response) ⇒ Headers
constructor
A new instance of Headers.
- #inspect ⇒ Object
-
#method_missing(method, *args, &block) ⇒ Object
Locking down to HTTPHeader methods only.
Constructor Details
#initialize(response) ⇒ Headers
Returns a new instance of Headers.
4 5 6 |
# File 'lib/awsum/s3/headers.rb', line 4 def initialize(response) @response = response end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
Locking down to HTTPHeader methods only
9 10 11 12 13 14 15 |
# File 'lib/awsum/s3/headers.rb', line 9 def method_missing(method, *args, &block) if !%w(body body_permitted? entity inspect read_body to_ary value).include?(method.to_s) && @response.respond_to?(method) @response.send(method, *args, &block) else raise NoMethodError.new("undefined method `#{method}' for #{inspect}") end end |
Instance Method Details
#inspect ⇒ Object
17 18 19 20 21 |
# File 'lib/awsum/s3/headers.rb', line 17 def inspect headers = [] @response.canonical_each do |h,v| headers << h end "#<Awsum::S3::Headers \"#{headers.join('", "')}\">" end |