Class: Mongoid::Enum::InvalidKey
- Inherits:
-
Object
- Object
- Mongoid::Enum::InvalidKey
- Defined in:
- lib/mongoid/enum/invalid_key.rb
Overview
Internal: Wraps invalid keys passed to setter so that getter returns the same key.
Instance Attribute Summary collapse
-
#original_key ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(key) ⇒ InvalidKey
constructor
A new instance of InvalidKey.
- #raise_error ⇒ Object (also: #bson_type, #to_bson)
Constructor Details
#initialize(key) ⇒ InvalidKey
Returns a new instance of InvalidKey.
11 12 13 |
# File 'lib/mongoid/enum/invalid_key.rb', line 11 def initialize(key) @original_key = key end |
Instance Attribute Details
#original_key ⇒ Object (readonly)
:nodoc:
9 10 11 |
# File 'lib/mongoid/enum/invalid_key.rb', line 9 def original_key @original_key end |
Instance Method Details
#raise_error ⇒ Object Also known as: bson_type, to_bson
15 16 17 |
# File 'lib/mongoid/enum/invalid_key.rb', line 15 def raise_error fail InvalidKeyError, "invalid enum key: #{original_key}" end |