Class: EJSONExt::Encoders::EscapeType

Inherits:
DefaultType show all
Defined in:
lib/ejson_ext/encoders/escape_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/escape_type.rb', line 4

def handler?
  @key == '$date' && !@value.is_a?(Time)
end

#keyObject



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

def key
  '$escape'
end

#valueObject



12
13
14
# File 'lib/ejson_ext/encoders/escape_type.rb', line 12

def value
  { @key => @value }
end