Class: Restapi::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/restapi/restapi_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



51
52
53
54
55
56
57
58
59
# File 'lib/restapi/restapi_module.rb', line 51

def initialize
  @markup = Restapi::Markup::RDoc.new
  @app_name = "Another API"
  @app_info = "Another API description"
  @copyright = nil
  @validate = true
  @api_base_url = ""
  @doc_base_url = "/restapi"
end

Instance Attribute Details

#api_base_urlObject

Returns the value of attribute api_base_url.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def api_base_url
  @api_base_url
end

#api_controllers_matcherObject

matcher to be used in Dir.glob to find controllers to be reloaded e.g.

"#{Rails.root}/app/controllers/api/*.rb"


35
36
37
# File 'lib/restapi/restapi_module.rb', line 35

def api_controllers_matcher
  @api_controllers_matcher
end

#app_infoObject

Returns the value of attribute app_info.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def app_info
  @app_info
end

#app_nameObject

Returns the value of attribute app_name.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def app_name
  @app_name
end

Returns the value of attribute copyright.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def copyright
  @copyright
end

#doc_base_urlObject

Returns the value of attribute doc_base_url.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def doc_base_url
  @doc_base_url
end

#markupObject

Returns the value of attribute markup.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def markup
  @markup
end

#reload_controllers=(value) ⇒ Object (writeonly)

set to true if you want to reload the controllers at each refresh of the documentation. It requires :api_controllers_matcher to be set to work properly.



40
41
42
# File 'lib/restapi/restapi_module.rb', line 40

def reload_controllers=(value)
  @reload_controllers = value
end

#validateObject

Returns the value of attribute validate.



29
30
31
# File 'lib/restapi/restapi_module.rb', line 29

def validate
  @validate
end

Instance Method Details

#reload_controllers?Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/restapi/restapi_module.rb', line 42

def reload_controllers?
  @reload_controllers = Rails.env.development? unless defined? @reload_controllers
  return @reload_controllers && @api_controllers_matcher
end