Exception: Eco::API::UseCases::BaseIO::Validations::MissingParameter

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/eco/api/usecases/base_io/validations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#givenObject (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

#klassObject (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

#requiredObject (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

#typeObject (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