Class: Swagger::Docs::Config
- Inherits:
-
Object
- Object
- Swagger::Docs::Config
- Defined in:
- lib/swagger/docs/config.rb
Constant Summary collapse
- @@base_api_controller =
nil
Class Method Summary collapse
- .base_api_controller ⇒ Object
- .base_api_controller=(controller) ⇒ Object (also: base_api_controllers=)
- .base_api_controllers ⇒ Object
- .base_application ⇒ Object
- .base_applications ⇒ Object
- .log_env_name ⇒ Object
- .log_exception ⇒ Object
- .register_apis(versions) ⇒ Object
- .registered_apis ⇒ Object
- .transform_path(path, api_version) ⇒ Object
- .write_log(type, output) ⇒ Object
Class Method Details
.base_api_controller ⇒ Object
7 8 9 |
# File 'lib/swagger/docs/config.rb', line 7 def base_api_controller @@base_api_controller || ActionController::Base end |
.base_api_controller=(controller) ⇒ Object Also known as: base_api_controllers=
15 16 17 |
# File 'lib/swagger/docs/config.rb', line 15 def base_api_controller=(controller) @@base_api_controller = controller end |
.base_api_controllers ⇒ Object
11 12 13 |
# File 'lib/swagger/docs/config.rb', line 11 def base_api_controllers Array(base_api_controller) end |
.base_application ⇒ Object
25 26 27 |
# File 'lib/swagger/docs/config.rb', line 25 def base_application Rails.application end |
.base_applications ⇒ Object
21 22 23 |
# File 'lib/swagger/docs/config.rb', line 21 def base_applications Array(base_application) end |
.log_env_name ⇒ Object
52 53 54 |
# File 'lib/swagger/docs/config.rb', line 52 def log_env_name 'SD_LOG_LEVEL' end |
.log_exception ⇒ Object
45 46 47 48 49 50 |
# File 'lib/swagger/docs/config.rb', line 45 def log_exception yield rescue => e write_log(:error, e) raise end |
.register_apis(versions) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/swagger/docs/config.rb', line 29 def register_apis(versions) base_api_controllers.each do |controller| controller.send(:include, ImpotentMethods) end @versions = versions end |
.registered_apis ⇒ Object
36 37 38 |
# File 'lib/swagger/docs/config.rb', line 36 def registered_apis @versions ||= {} end |
.transform_path(path, api_version) ⇒ Object
40 41 42 43 |
# File 'lib/swagger/docs/config.rb', line 40 def transform_path(path, api_version) # This is only for overriding, so don't perform any path transformations by default. path end |
.write_log(type, output) ⇒ Object
56 57 58 |
# File 'lib/swagger/docs/config.rb', line 56 def write_log(type, output) $stderr.puts output if type == :error and ENV[log_env_name]=="1" end |