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.



94
95
96
97
98
99
100
101
102
# File 'lib/restapi/restapi_module.rb', line 94

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"


37
38
39
# File 'lib/restapi/restapi_module.rb', line 37

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

#cache_dirObject



59
60
61
# File 'lib/restapi/restapi_module.rb', line 59

def cache_dir
  @cache_dir ||= File.join(Rails.root, "public", "restapi-cache")
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

#force_dsl=(value) ⇒ Object (writeonly)

if there is not obvious reason why the DSL should be turned on (no validations, cache turned on etc.), it’s disabled to avoid unneeded allocation. It you need the DSL for other reasons, you can force the activation.



67
68
69
# File 'lib/restapi/restapi_module.rb', line 67

def force_dsl=(value)
  @force_dsl = value
end

#generated_doc_disclaimerObject



86
87
88
# File 'lib/restapi/restapi_module.rb', line 86

def generated_doc_disclaimer
  @generated_doc_disclaimer ||= "# DOC GENERATED AUTOMATICALLY: REMOVE THIS LINE TO PREVENT REGENARATING NEXT TIME"
end

#ignored_by_recorderObject



76
77
78
79
# File 'lib/restapi/restapi_module.rb', line 76

def ignored_by_recorder
  @ignored_by_recorder ||= []
  @ignored_by_recorder.map(&:to_s)
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.



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

def reload_controllers=(value)
  @reload_controllers = value
end

#use_cacheObject Also known as: use_cache?

set to true if you want to use pregenerated documentation cache and avoid generating the documentation on runtime (usefull for production environment). You can generate the cache by running

rake restapi:cache


55
56
57
# File 'lib/restapi/restapi_module.rb', line 55

def use_cache
  @use_cache
end

#validateObject Also known as: validate?

Returns the value of attribute validate.



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

def validate
  @validate
end

Instance Method Details

#force_dsl?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/restapi/restapi_module.rb', line 68

def force_dsl?
  @force_dsl
end

#reload_controllers?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/restapi/restapi_module.rb', line 44

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