Class: Apipie::Configuration
- Inherits:
-
Object
- Object
- Apipie::Configuration
- Defined in:
- lib/apipie/configuration.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.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#default_version ⇒ Object
Returns the value of attribute default_version.
-
#disqus_shortname ⇒ Object
Returns the value of attribute disqus_shortname.
-
#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 ⇒ Object
- #ignored_by_recorder ⇒ Object
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#markup ⇒ Object
Returns the value of attribute markup.
-
#namespaced_resources ⇒ Object
(also: #namespaced_resources?)
Returns the value of attribute namespaced_resources.
-
#reload_controllers ⇒ Object
writeonly
set to true if you want to reload the controllers at each refresh of the documentation.
-
#required_by_default ⇒ Object
(also: #required_by_default?)
Returns the value of attribute required_by_default.
-
#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.
-
#validate_presence ⇒ Object
(also: #validate_presence?)
Returns the value of attribute validate_presence.
-
#validate_value ⇒ Object
(also: #validate_value?)
Returns the value of attribute validate_value.
-
#version_in_url ⇒ Object
Returns the value of attribute version_in_url.
Instance Method Summary collapse
- #force_dsl? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reload_controllers? ⇒ Boolean
- #use_disqus? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/apipie/configuration.rb', line 109 def initialize @markup = Apipie::Markup::RDoc.new @app_name = "Another API" @app_info = HashWithIndifferentAccess.new @copyright = nil @validate = true @validate_value = true @validate_presence = true @required_by_default = false @api_base_url = HashWithIndifferentAccess.new @doc_base_url = "/apipie" @layout = "apipie/apipie" @disqus_shortname = nil @default_version = "1.0" @debug = false @version_in_url = true @namespaced_resources = false end |
Instance Attribute Details
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 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"
17 18 19 |
# File 'lib/apipie/configuration.rb', line 17 def api_controllers_matcher @api_controllers_matcher end |
#app_info ⇒ Object
Returns the value of attribute app_info.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def app_info @app_info end |
#app_name ⇒ Object
Returns the value of attribute app_name.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def app_name @app_name end |
#cache_dir ⇒ Object
49 50 51 |
# File 'lib/apipie/configuration.rb', line 49 def cache_dir @cache_dir ||= File.join(Rails.root, "public", "apipie-cache") end |
#copyright ⇒ Object
Returns the value of attribute copyright.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def copyright @copyright end |
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def debug @debug end |
#default_version ⇒ Object
Returns the value of attribute default_version.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def default_version @default_version end |
#disqus_shortname ⇒ Object
Returns the value of attribute disqus_shortname.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def disqus_shortname @disqus_shortname end |
#doc_base_url ⇒ Object
Returns the value of attribute doc_base_url.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 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.
57 58 59 |
# File 'lib/apipie/configuration.rb', line 57 def force_dsl=(value) @force_dsl = value end |
#generated_doc_disclaimer ⇒ Object
85 86 87 |
# File 'lib/apipie/configuration.rb', line 85 def generated_doc_disclaimer @generated_doc_disclaimer ||= "# DOC GENERATED AUTOMATICALLY: REMOVE THIS LINE TO PREVENT REGENARATING NEXT TIME" end |
#ignored ⇒ Object
75 76 77 78 |
# File 'lib/apipie/configuration.rb', line 75 def ignored @ignored ||= [] @ignored.map(&:to_s) end |
#ignored_by_recorder ⇒ Object
66 67 68 69 |
# File 'lib/apipie/configuration.rb', line 66 def ignored_by_recorder @ignored_by_recorder ||= [] @ignored_by_recorder.map(&:to_s) end |
#layout ⇒ Object
Returns the value of attribute layout.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def layout @layout end |
#markup ⇒ Object
Returns the value of attribute markup.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def markup @markup end |
#namespaced_resources ⇒ Object Also known as: namespaced_resources?
Returns the value of attribute namespaced_resources.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def namespaced_resources @namespaced_resources 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.
22 23 24 |
# File 'lib/apipie/configuration.rb', line 22 def reload_controllers=(value) @reload_controllers = value end |
#required_by_default ⇒ Object Also known as: required_by_default?
Returns the value of attribute required_by_default.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def required_by_default @required_by_default 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 apipie:cache
45 46 47 |
# File 'lib/apipie/configuration.rb', line 45 def use_cache @use_cache end |
#validate ⇒ Object Also known as: validate?
Returns the value of attribute validate.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def validate @validate end |
#validate_presence ⇒ Object Also known as: validate_presence?
Returns the value of attribute validate_presence.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def validate_presence @validate_presence end |
#validate_value ⇒ Object Also known as: validate_value?
Returns the value of attribute validate_value.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def validate_value @validate_value end |
#version_in_url ⇒ Object
Returns the value of attribute version_in_url.
4 5 6 |
# File 'lib/apipie/configuration.rb', line 4 def version_in_url @version_in_url end |
Instance Method Details
#force_dsl? ⇒ Boolean
58 59 60 |
# File 'lib/apipie/configuration.rb', line 58 def force_dsl? @force_dsl end |
#reload_controllers? ⇒ Boolean
24 25 26 27 |
# File 'lib/apipie/configuration.rb', line 24 def reload_controllers? @reload_controllers = Rails.env.development? unless defined? @reload_controllers return @reload_controllers && @api_controllers_matcher end |
#use_disqus? ⇒ Boolean
89 90 91 |
# File 'lib/apipie/configuration.rb', line 89 def use_disqus? !@disqus_shortname.blank? end |