Class: Fog::Attributes::Timestamp

Inherits:
Default
  • Object
show all
Defined in:
lib/fog/core/attributes/timestamp.rb

Overview

Fog Timestamp Attribute

This class handles Timestamp attributes from the providers, converting Integer and String values as a real Timestamp objects

Instance Attribute Summary

Attributes inherited from Default

#aliases, #as, #default, #model, #name, #squash

Instance Method Summary collapse

Methods inherited from Default

#create_aliases, #create_getter, #create_mask, #initialize, #set_defaults

Constructor Details

This class inherits a constructor from Fog::Attributes::Default

Instance Method Details

#create_setterObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/core/attributes/timestamp.rb', line 8

def create_setter
  model.class_eval <<-EOS, __FILE__, __LINE__
      def #{name}=(new_#{name})
        if new_#{name}.respond_to?(:to_i)
          attributes[:#{name}] = Fog::Time.at(new_#{name}.to_i)
        else
          attributes[:#{name}] = Fog::Time.parse(new_#{name}.to_s)
        end
      end
  EOS
end