Class: CypressDev::Middleware::Command

Inherits:
Struct
  • Object
show all
Defined in:
lib/cypress_dev/middleware.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_body(body, configuration) ⇒ Array<Cypress::Middleware::Command>

Returns:

  • (Array<Cypress::Middleware::Command>)


36
37
38
39
40
41
42
43
44
45
# File 'lib/cypress_dev/middleware.rb', line 36

def self.from_body(body, configuration)
  if body.is_a?(Array)
    command_params = body
  else
    command_params = [body]
  end
  command_params.map do |params|
    new(params.fetch('name'), params['options'], configuration.cypress_folder)
  end
end

Instance Method Details

#file_pathObject



47
48
49
# File 'lib/cypress_dev/middleware.rb', line 47

def file_path
  "#{cypress_folder}/app_commands/#{name}.rb"
end