Class: Dryer::Clients::GeneratedClients::Paths::Variables::Validate

Inherits:
Services::ResultService
  • Object
show all
Defined in:
lib/dryer/clients/generated_clients/paths/variables/validate.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, path_variables) ⇒ Validate

Returns a new instance of Validate.



10
11
12
13
# File 'lib/dryer/clients/generated_clients/paths/variables/validate.rb', line 10

def initialize(path, path_variables)
  @path = path
  @path_variables = path_variables
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dryer/clients/generated_clients/paths/variables/validate.rb', line 15

def call
  if path_variable_keys.length != path_variables.length
    Failure(
      StandardError.new(
        <<~MSG
          Path #{path} requires #{path_variable_keys.length} variables,
          #{path_variables} contains #{path_variables.length}.
        MSG
      )
    )
  else
    Success()
  end
end