Exception: Eco::API::UseCases::BaseIO::Validations::MissingParameter
- Inherits:
-
ArgumentError
- Object
- ArgumentError
- Eco::API::UseCases::BaseIO::Validations::MissingParameter
- Defined in:
- lib/eco/api/usecases/base_io/validations.rb
Instance Attribute Summary collapse
-
#given ⇒ Object
readonly
Returns the value of attribute given.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(msg = nil, required:, given:, type: nil, usecase: nil) ⇒ MissingParameter
constructor
A new instance of MissingParameter.
Constructor Details
#initialize(msg = nil, required:, given:, type: nil, usecase: nil) ⇒ MissingParameter
Returns a new instance of MissingParameter.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/eco/api/usecases/base_io/validations.rb', line 6 def initialize(msg = nil, required:, given:, type: nil, usecase: nil) @type = type @required = required @given = given @klass = to_class(usecase) msg = "#{msg} of type '#{type}'" if type msg = "#{msg} (#{klass})" if klass msg = "#{msg} requires an object '#{required}'. Given: #{given}." super(msg) end |
Instance Attribute Details
#given ⇒ Object (readonly)
Returns the value of attribute given.
4 5 6 |
# File 'lib/eco/api/usecases/base_io/validations.rb', line 4 def given @given end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
4 5 6 |
# File 'lib/eco/api/usecases/base_io/validations.rb', line 4 def klass @klass end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
4 5 6 |
# File 'lib/eco/api/usecases/base_io/validations.rb', line 4 def required @required end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/eco/api/usecases/base_io/validations.rb', line 4 def type @type end |