Class: KDL::Types::DateTime

Inherits:
Value::Custom show all
Defined in:
lib/kdl/types/date_time.rb

Constant Summary

Constants inherited from Value

Value::Null

Instance Attribute Summary

Attributes inherited from Value::Custom

#oriinal_value

Attributes inherited from Value

#format, #type, #value

Class Method Summary collapse

Methods inherited from Value::Custom

#to_v1, #to_v2, #version

Methods inherited from Value

#==, #as_type, from, #initialize, #inspect, #method_missing, #respond_to_missing?, #stringify_value, #to_s, #to_v2, #version

Constructor Details

This class inherits a constructor from KDL::Value

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class KDL::Value

Class Method Details

.call(value, type = 'date-time') ⇒ Object



8
9
10
11
12
13
# File 'lib/kdl/types/date_time.rb', line 8

def self.call(value, type = 'date-time')
  return nil unless value.is_a? ::KDL::Value::String

  time = ::Time.iso8601(value.value)
  new(time, type: type)
end