Sha256: 2f875d079d9fb1b8dc09373cf4c8a41a2c424319474a25334478f20b2616b8d4

Contents?: true

Size: 529 Bytes

Versions: 2

Compression:

Stored size: 529 Bytes

Contents

module Fog
  module Attributes
    class Time < Default
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-core-1.24.0 lib/fog/core/attributes/time.rb
fog-core-1.23.0 lib/fog/core/attributes/time.rb