Class: Rodauth::Generators::OpenAPIGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/rodauth/openapi_generator.rb

Instance Method Summary collapse

Instance Method Details



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/generators/rodauth/openapi_generator.rb', line 24

def print_documentation
  open_api = Rodauth::OpenAPI.new(auth_class, password: options[:password], json: options[:json])
  documentation = open_api.public_send(:"to_#{options[:format]}")

  if options[:save]
    File.write(options[:save], documentation)
  else
    puts documentation
  end
rescue Rodauth::OpenAPI::Error => error
  say error.message, :red
end