Class: SpecForge::Error::InvalidGenerateFunctionError

Inherits:
Error
  • Object
show all
Defined in:
lib/spec_forge/error.rb

Overview

Raised when an unknown generation function is referenced Indicates when a generation name isn't supported

Instance Method Summary collapse

Constructor Details

#initialize(input, valid_functions) ⇒ InvalidGenerateFunctionError

Returns a new instance of InvalidGenerateFunctionError.



83
84
85
86
87
88
89
90
91
92
# File 'lib/spec_forge/error.rb', line 83

def initialize(input, valid_functions)
  formatted_functions = valid_functions.join_map(", ") { |f| "generate.#{f}".in_quotes }

  super(<<~STRING.chomp
    Undefined generate function "#{input}".

    Valid functions: #{formatted_functions}
  STRING
  )
end