Class: Fog::Attributes::Time
- Defined in:
- lib/fog/core/attributes/time.rb
Instance Attribute Summary
Attributes inherited from Default
Instance Method Summary collapse
Methods inherited from Default
#create, #create_getter, #initialize
Constructor Details
This class inherits a constructor from Fog::Attributes::Default
Instance Method Details
#create_setter ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/core/attributes/time.rb', line 4 def create_setter model.class_eval <<-EOS, __FILE__, __LINE__ def #{name}=(new_#{name}) attributes[:#{name}] = if new_#{name}.nil? || new_#{name} == "" || new_#{name}.is_a?(::Time) new_#{name} elsif new_#{name}.respond_to?(:to_time) new_#{name}.to_time else ::Time.parse(new_#{name}) end end EOS end |