Class: EasySwaggerUi::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_swagger_ui/configuration.rb

Constant Summary collapse

OPTIONS =

Configurable options

[
  :base_path,
  :cache_enabled,
  :cache_timeout,
  :cache_store,
  :validator_enabled,
].freeze

Instance Method Summary collapse

Instance Method Details

#base_path=(path) ⇒ Object

Make sure it’s an absolute path



19
20
21
# File 'lib/easy_swagger_ui/configuration.rb', line 19

def base_path=(path)
  @base_path = File.absolute_path(path, Rails.root)
end

#cache_store=(store) ⇒ Object

Evaluate lambda when needed



24
25
26
# File 'lib/easy_swagger_ui/configuration.rb', line 24

def cache_store=(store)
  @cache_store = store.respond_to?(:call) ? store.call : store
end

#to_hObject



28
29
30
31
32
# File 'lib/easy_swagger_ui/configuration.rb', line 28

def to_h
  OPTIONS.each_with_object({}) do |key, config|
    config[key] = send(key)
  end
end