Class: Swagger::Docs::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger/docs/config.rb

Constant Summary collapse

@@base_api_controller =
nil

Class Method Summary collapse

Class Method Details

.base_api_controllerObject


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_controllersObject


11
12
13
# File 'lib/swagger/docs/config.rb', line 11

def base_api_controllers
  Array(base_api_controller)
end

.base_applicationObject


25
26
27
# File 'lib/swagger/docs/config.rb', line 25

def base_application
  Rails.application 
end

.base_applicationsObject


21
22
23
# File 'lib/swagger/docs/config.rb', line 21

def base_applications
  Array(base_application)
end

.log_env_nameObject


52
53
54
# File 'lib/swagger/docs/config.rb', line 52

def log_env_name
  'SD_LOG_LEVEL'
end

.log_exceptionObject


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_apisObject


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