Class: Primalize::Single::Timestamp

Inherits:
Object
  • Object
show all
Includes:
Type
Defined in:
lib/primalize/single.rb

Constant Summary collapse

TYPES =
[Time, Date, DateTime].freeze

Constants included from Type

Primalize::Single::Type::DEFAULT_COERCION

Instance Method Summary collapse

Methods included from Type

#coerce

Constructor Details

#initialize(&coercion) ⇒ Timestamp

Returns a new instance of Timestamp.



312
313
314
# File 'lib/primalize/single.rb', line 312

def initialize &coercion
  @coercion = coercion
end

Instance Method Details

#===(value) ⇒ Object



316
317
318
# File 'lib/primalize/single.rb', line 316

def === value
  TYPES.any? { |type| type === value }
end

#inspectObject



320
321
322
# File 'lib/primalize/single.rb', line 320

def inspect
  'timestamp'
end