Class: EJSONExt::Encoders::TimeType

Inherits:
DefaultType show all
Defined in:
lib/ejson_ext/encoders/time_type.rb

Instance Method Summary collapse

Methods inherited from DefaultType

#initialize, #next_handler, #next_handler=, #parse

Constructor Details

This class inherits a constructor from EJSONExt::Encoders::DefaultType

Instance Method Details

#handler?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/ejson_ext/encoders/time_type.rb', line 4

def handler?
  @value.is_a?(Time)
end

#valueObject



8
9
10
# File 'lib/ejson_ext/encoders/time_type.rb', line 8

def value
  { '$date' => (@value.to_i * 1_000) }
end