Class: RailsApiDocs::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-api-docs/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rails-api-docs/configuration.rb', line 10

def initialize
  @config_path           = "config/rails-api-docs.yml"
  @output_path           = "public/api-docs.html"
  @mount_path            = "/rails/api-docs"
  @mount_in_development  = true
  @route_source          = nil

  # User-extensible filters applied by RouteInspector. They stack on top
  # of the built-in INTERNAL_PREFIXES list — they don't replace it.
  #
  # ignored_* are blacklists. only_controllers is a whitelist. Strings
  # without "/" match by boundary-aware suffix (so "users" matches
  # `users` and `api/v1/users` but not `super_users`). Strings with "/"
  # match exactly. Regexps match via `Regexp#match?`.
  # Blacklist wins when a controller is in both lists.
  @ignored_path_prefixes = []
  @ignored_controllers   = []
  @ignored_actions       = []
  @only_controllers      = []

  # When true, scaffold only includes routes whose controller is JSON-returning
  # (inherits from ActionController::API, or has `render json:` in the action body).
  # Can be set per-run via `rails g rails-api-docs:init --api-only` (or `:update`).
  @api_only              = false

  # When true, scaffold emits EVERY possible YAML key per endpoint and field
  # (format, enum, default, min/max, pattern, read/write_only, nullable,
  # response headers/schema, etc.) with defaults — full discoverability at
  # the cost of much longer files. Default (false) emits only the commonly-
  # edited keys: description, example, and the existing inferred fields.
  # Per-run via `--verbose-yaml`.
  @verbose_yaml          = false
end

Instance Attribute Details

#api_onlyObject

Returns the value of attribute api_only.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def api_only
  @api_only
end

#config_pathObject

Returns the value of attribute config_path.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def config_path
  @config_path
end

#ignored_actionsObject

Returns the value of attribute ignored_actions.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def ignored_actions
  @ignored_actions
end

#ignored_controllersObject

Returns the value of attribute ignored_controllers.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def ignored_controllers
  @ignored_controllers
end

#ignored_path_prefixesObject

Returns the value of attribute ignored_path_prefixes.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def ignored_path_prefixes
  @ignored_path_prefixes
end

#mount_in_developmentObject

Returns the value of attribute mount_in_development.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def mount_in_development
  @mount_in_development
end

#mount_pathObject

Returns the value of attribute mount_path.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def mount_path
  @mount_path
end

#only_controllersObject

Returns the value of attribute only_controllers.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def only_controllers
  @only_controllers
end

#output_pathObject

Returns the value of attribute output_path.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def output_path
  @output_path
end

#route_sourceObject

Default lazy lookup — resolved at call time so Rails.application is set by the time the generator runs. Tests can inject a custom RouteSet.



46
47
48
# File 'lib/rails-api-docs/configuration.rb', line 46

def route_source
  @route_source || Rails.application.routes
end

#verbose_yamlObject

Returns the value of attribute verbose_yaml.



5
6
7
# File 'lib/rails-api-docs/configuration.rb', line 5

def verbose_yaml
  @verbose_yaml
end