Sha256: 943d18aed9fcbd71360ad0f3cc23df6f93d7480177b583da2a74bd84248a2413

Contents?: true

Size: 751 Bytes

Versions: 41

Compression:

Stored size: 751 Bytes

Contents

module Fog
  module Attributes
    # = Fog Time Attribute
    #
    # This class handles Time attributes from the providers,
    # converting values to Time objects
    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 ::String === new_#{name}
                ::Time.parse(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

41 entries across 38 versions & 3 rubygems

Version Path
fog-core-1.44.1 lib/fog/core/attributes/time.rb
fog-core-1.44.0 lib/fog/core/attributes/time.rb
fog-core-1.43.0 lib/fog/core/attributes/time.rb
fog-core-1.42.0 lib/fog/core/attributes/time.rb
fog-core-1.41.0 lib/fog/core/attributes/time.rb
fog-core-1.40.1 lib/fog/core/attributes/time.rb
fog-core-1.40.0 lib/fog/core/attributes/time.rb
fog-core-1.39.0 lib/fog/core/attributes/time.rb
fog-core-1.38.0 lib/fog/core/attributes/time.rb
fog-core-1.37.0 lib/fog/core/attributes/time.rb
fog-core-1.36.0 lib/fog/core/attributes/time.rb
fog-core-1.35.0 lib/fog/core/attributes/time.rb
fog-core-1.34.0 lib/fog/core/attributes/time.rb
fog-core-1.33.0 lib/fog/core/attributes/time.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-core-1.32.1/lib/fog/core/attributes/time.rb
fog-core-1.32.1 lib/fog/core/attributes/time.rb
fog-core-1.32.0 lib/fog/core/attributes/time.rb
fog-core-1.31.1 lib/fog/core/attributes/time.rb
fog-core-1.31.0 lib/fog/core/attributes/time.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-core-1.30.0/lib/fog/core/attributes/time.rb