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.



328
329
330
# File 'lib/primalize/single.rb', line 328

def initialize &coercion
  @coercion = coercion
end

Instance Method Details

#===(value) ⇒ Object



332
333
334
# File 'lib/primalize/single.rb', line 332

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

#inspectObject



336
337
338
# File 'lib/primalize/single.rb', line 336

def inspect
  'timestamp'
end