You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Xml::Parser::TimestampFrame

Inherits:
Frame
  • Object
show all
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb

Instance Attribute Summary

Attributes inherited from Frame

#parent, #ref

Instance Method Summary collapse

Methods inherited from Frame

#child_frame, #consume_child_frame, #initialize, new, #set_text

Constructor Details

This class inherits a constructor from Aws::Xml::Parser::Frame

Instance Method Details

#parse(value) ⇒ Object



277
278
279
280
281
282
283
284
285
286
287
288
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb', line 277

def parse(value)
  case value
  when nil then nil
  when /^\d+$/ then Time.at(value.to_i)
  else
    begin
      Time.parse(value).utc
    rescue ArgumentError
      raise "unhandled timestamp format `#{value}'"
    end
  end
end

#resultObject



274
275
276
# File 'gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/frame.rb', line 274

def result
  @text.empty? ? nil : parse(@text.join)
end