Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/sequent/core/ext/ext.rb,
lib/sequent/test/time_comparison.rb
Class Method Summary collapse
Methods included from Sequent::Test::DateTimePatches::Normalize
Methods included from Sequent::Test::DateTimePatches::Compare
Class Method Details
.deserialize_from_json(value) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/sequent/core/ext/ext.rb', line 78 def self.deserialize_from_json(value) value.blank? ? nil : Time.iso8601(value.dup) rescue ArgumentError => e return Time.parse(value.dup) if e. =~ /invalid xmlschema format/ # ruby >= 3 return Time.parse(value.dup) if e. =~ /invalid date:/ # ruby 2.7 raise end |
.from_params(value) ⇒ Object
72 73 74 75 76 |
# File 'lib/sequent/core/ext/ext.rb', line 72 def self.from_params(value) value.blank? ? nil : Time.iso8601(value.dup) rescue ArgumentError value end |