Exception: Mongoid::Errors::InvalidTime

Inherits:
MongoidError show all
Defined in:
lib/mongoid/errors/invalid_time.rb

Overview

This exception is raised when a bad value is attempted to be converted to a date or time.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from MongoidError

#translate

Constructor Details

#initialize(value) ⇒ InvalidTime

Create the new invalid date error.

Examples:

Create the new invalid date error.

InvalidTime.new("this is not a time")

Parameters:

  • value (Object)

    The value that was attempted.

Since:

  • 2.3.1



19
20
21
22
# File 'lib/mongoid/errors/invalid_time.rb', line 19

def initialize(value)
  @value = value
  super(translate("invalid_time", { :value => value }))
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



9
10
11
# File 'lib/mongoid/errors/invalid_time.rb', line 9

def klass
  @klass
end

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/mongoid/errors/invalid_time.rb', line 9

def value
  @value
end