Class: Restapi::Configuration
- Inherits:
-
Object
- Object
- Restapi::Configuration
- Defined in:
- lib/restapi/restapi_module.rb
Instance Attribute Summary collapse
-
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
-
#api_controllers_matcher ⇒ Object
matcher to be used in Dir.glob to find controllers to be reloaded e.g.
-
#app_info ⇒ Object
Returns the value of attribute app_info.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
- #cache_dir ⇒ Object
-
#copyright ⇒ Object
Returns the value of attribute copyright.
-
#doc_base_url ⇒ Object
Returns the value of attribute doc_base_url.
-
#force_dsl ⇒ 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.
- #generated_doc_disclaimer ⇒ Object
- #ignored_by_recorder ⇒ Object
-
#markup ⇒ Object
Returns the value of attribute markup.
-
#reload_controllers ⇒ Object
writeonly
set to true if you want to reload the controllers at each refresh of the documentation.
-
#use_cache ⇒ Object
(also: #use_cache?)
set to true if you want to use pregenerated documentation cache and avoid generating the documentation on runtime (usefull for production environment).
-
#validate ⇒ Object
(also: #validate?)
Returns the value of attribute validate.
Instance Method Summary collapse
- #force_dsl? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reload_controllers? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
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_url ⇒ Object
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_matcher ⇒ Object
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_info ⇒ Object
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_name ⇒ Object
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_dir ⇒ Object
59 60 61 |
# File 'lib/restapi/restapi_module.rb', line 59 def cache_dir @cache_dir ||= File.join(Rails.root, "public", "restapi-cache") end |
#copyright ⇒ Object
Returns the value of attribute copyright.
29 30 31 |
# File 'lib/restapi/restapi_module.rb', line 29 def copyright @copyright end |
#doc_base_url ⇒ Object
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_disclaimer ⇒ Object
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_recorder ⇒ Object
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 |
#markup ⇒ Object
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_cache ⇒ Object 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 |
#validate ⇒ Object 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
68 69 70 |
# File 'lib/restapi/restapi_module.rb', line 68 def force_dsl? @force_dsl end |
#reload_controllers? ⇒ 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 |