Class: Cuprum::Cli::Errors::Files::MissingParameter

Inherits:
TemplateError
  • Object
show all
Defined in:
lib/cuprum/cli/errors/files/missing_parameter.rb

Overview

Error returned when a required parameter is missing when rendering content.

Constant Summary collapse

TYPE =

Short string used to identify the type of error.

'cuprum.cli.errors.files.missing_parameter'

Instance Attribute Summary collapse

Attributes inherited from TemplateError

#details, #template_name

Instance Method Summary collapse

Constructor Details

#initialize(parameter_name:, details: nil, format: nil, message: nil, template_name: nil) ⇒ MissingParameter

Returns a new instance of MissingParameter.

Parameters:

  • parameter_name (String, Symbol)

    the name of the missing parameter.

  • details (String) (defaults to: nil)

    additional information about the error.

  • format (String) (defaults to: nil)

    the content format.

  • message (String) (defaults to: nil)

    an optional message to display.

  • template_name (String) (defaults to: nil)

    the name of the rendered content, if any,



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cuprum/cli/errors/files/missing_parameter.rb', line 17

def initialize(
  parameter_name:,
  details: nil,
  format: nil,
  message: nil,
  template_name: nil
)
  @parameter_name = parameter_name
  @format         = format
  @template_name  = template_name

  super(
    details:,
    format:,
    message:        default_message(message),
    parameter_name:,
    template_name:
  )
end

Instance Attribute Details

#formatString (readonly)

Returns the content format.

Returns:

  • (String)

    the content format.



38
39
40
# File 'lib/cuprum/cli/errors/files/missing_parameter.rb', line 38

def format
  @format
end

#parameter_nameString, Symbol (readonly)

Returns the name of the missing parameter.

Returns:

  • (String, Symbol)

    the name of the missing parameter.



41
42
43
# File 'lib/cuprum/cli/errors/files/missing_parameter.rb', line 41

def parameter_name
  @parameter_name
end