Exception: SmartParams::Error::InvalidPropertyType
- Inherits:
-
SmartParams::Error
- Object
- StandardError
- SmartParams::Error
- SmartParams::Error::InvalidPropertyType
- Defined in:
- lib/smart_params/error/invalid_property_type.rb
Instance Attribute Summary collapse
-
#keychain ⇒ Object
readonly
Returns the value of attribute keychain.
-
#missing_key ⇒ Object
readonly
Returns the value of attribute missing_key.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#wanted ⇒ Object
readonly
Returns the value of attribute wanted.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(keychain:, wanted:, raw:, missing_key: nil) ⇒ InvalidPropertyType
constructor
A new instance of InvalidPropertyType.
- #message ⇒ Object
Constructor Details
#initialize(keychain:, wanted:, raw:, missing_key: nil) ⇒ InvalidPropertyType
Returns a new instance of InvalidPropertyType.
11 12 13 14 15 16 17 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 11 def initialize(keychain:, wanted:, raw:, missing_key: nil) super @keychain = keychain @wanted = wanted @raw = raw @missing_key = missing_key end |
Instance Attribute Details
#keychain ⇒ Object (readonly)
Returns the value of attribute keychain.
6 7 8 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 6 def keychain @keychain end |
#missing_key ⇒ Object (readonly)
Returns the value of attribute missing_key.
9 10 11 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 9 def missing_key @missing_key end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
8 9 10 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 8 def raw @raw end |
#wanted ⇒ Object (readonly)
Returns the value of attribute wanted.
7 8 9 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 7 def wanted @wanted end |
Instance Method Details
#as_json ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 27 def as_json { "keychain" => keychain, "wanted" => wanted.name, "raw" => raw } end |
#message ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/smart_params/error/invalid_property_type.rb', line 19 def if missing_key "expected #{keychain.inspect} to be #{wanted.name} with key #{missing_key.inspect}, but is #{raw.inspect}" else "expected #{keychain.inspect} to be #{wanted.name}, but is #{raw.inspect}" end end |