Class: ApipieDSL::Configuration
- Inherits:
-
Object
- Object
- ApipieDSL::Configuration
- Defined in:
- lib/apipie_dsl/configuration.rb
Instance Attribute Summary collapse
-
#app_info ⇒ Object
Returns the value of attribute app_info.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#authenticate ⇒ Object
Returns the value of attribute authenticate.
-
#authorize ⇒ Object
Returns the value of attribute authorize.
-
#autoload_methods ⇒ Object
(also: #autoload_methods?)
Returns the value of attribute autoload_methods.
- #cache_dir ⇒ Object
-
#class_full_names ⇒ Object
(also: #class_full_names?)
Returns the value of attribute class_full_names.
-
#copyright ⇒ Object
Returns the value of attribute copyright.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#default_locale ⇒ Object
Returns the value of attribute default_locale.
- #default_section ⇒ Object
-
#default_version ⇒ Object
Returns the value of attribute default_version.
-
#doc_base_url ⇒ Object
Returns the value of attribute doc_base_url.
-
#doc_path ⇒ Object
Returns the value of attribute doc_path.
-
#dsl_classes_matcher ⇒ Object
Returns the value of attribute dsl_classes_matcher.
- #dsl_classes_matchers ⇒ Object
-
#help_layout ⇒ Object
Returns the value of attribute help_layout.
-
#ignored ⇒ Object
array of class names (strings) (might include methods as well) to be ignored when generationg the documentation e.g.
-
#languages ⇒ Object
Returns the value of attribute languages.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#link_extension ⇒ Object
Returns the value of attribute link_extension.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#markup ⇒ Object
Returns the value of attribute markup.
-
#rails ⇒ Object
(also: #rails?)
Returns the value of attribute rails.
-
#reload_dsl ⇒ Object
writeonly
Sets the attribute reload_dsl.
-
#sections ⇒ Object
Returns the value of attribute sections.
-
#translate ⇒ Object
Returns the value of attribute translate.
-
#use_cache ⇒ Object
(also: #use_cache?)
Returns the value of attribute use_cache.
-
#validate ⇒ Object
(also: #validate?)
Returns the value of attribute validate.
- #validate_value ⇒ Object (also: #validate_value?)
-
#version_in_url ⇒ Object
Returns the value of attribute version_in_url.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reload_dsl? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/apipie_dsl/configuration.rb', line 65 def initialize @markup = ApipieDSL::Markup::RDoc.new @app_name = 'Another DOC' @app_info = {} @copyright = nil @validate = false @validate_value = true @doc_base_url = '/apipie-dsl' @layout = 'apipie_dsl/apipie_dsl' @default_version = '1.0' @debug = false @version_in_url = true @doc_path = 'doc' @link_extension = '.html' @languages = [] @default_locale = 'en' @locale = lambda { |_locale| @default_locale } @translate = lambda { |str, _locale| str } @class_full_names = true @autoload_methods = false @dsl_classes_matcher = '' @dsl_classes_matchers = [] @sections = ['all'] @default_section = nil @rails = true end |
Instance Attribute Details
#app_info ⇒ Object
Returns the value of attribute app_info.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def app_info @app_info end |
#app_name ⇒ Object
Returns the value of attribute app_name.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def app_name @app_name end |
#authenticate ⇒ Object
Returns the value of attribute authenticate.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def authenticate @authenticate end |
#authorize ⇒ Object
Returns the value of attribute authorize.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def @authorize end |
#autoload_methods ⇒ Object Also known as: autoload_methods?
Returns the value of attribute autoload_methods.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def autoload_methods @autoload_methods end |
#cache_dir ⇒ Object
20 21 22 23 24 25 |
# File 'lib/apipie_dsl/configuration.rb', line 20 def cache_dir return @cache_dir if @cache_dir raise ConfigurationError.new('Please specify cache_dir to be able to use caching.') unless rails? @cache_dir = File.join(Rails.root, 'public', 'apipie-dsl-cache') end |
#class_full_names ⇒ Object Also known as: class_full_names?
Returns the value of attribute class_full_names.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def class_full_names @class_full_names end |
#copyright ⇒ Object
Returns the value of attribute copyright.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def copyright @copyright end |
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def debug @debug end |
#default_locale ⇒ Object
Returns the value of attribute default_locale.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def default_locale @default_locale end |
#default_section ⇒ Object
61 62 63 |
# File 'lib/apipie_dsl/configuration.rb', line 61 def default_section @default_section || @sections.first end |
#default_version ⇒ Object
Returns the value of attribute default_version.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def default_version @default_version end |
#doc_base_url ⇒ Object
Returns the value of attribute doc_base_url.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def doc_base_url @doc_base_url end |
#doc_path ⇒ Object
Returns the value of attribute doc_path.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def doc_path @doc_path end |
#dsl_classes_matcher ⇒ Object
Returns the value of attribute dsl_classes_matcher.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def dsl_classes_matcher @dsl_classes_matcher end |
#dsl_classes_matchers ⇒ Object
45 46 47 48 49 50 |
# File 'lib/apipie_dsl/configuration.rb', line 45 def dsl_classes_matchers unless @dsl_classes_matcher.empty? @dsl_classes_matchers << @dsl_classes_matcher end @dsl_classes_matchers = @dsl_classes_matchers.uniq end |
#help_layout ⇒ Object
Returns the value of attribute help_layout.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def help_layout @help_layout end |
#ignored ⇒ Object
array of class names (strings) (might include methods as well) to be ignored when generationg the documentation e.g. %w[DSL::MyClass DSL::IO#puts]
35 36 37 38 |
# File 'lib/apipie_dsl/configuration.rb', line 35 def ignored @ignored ||= [] @ignored.map(&:to_s) end |
#languages ⇒ Object
Returns the value of attribute languages.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def languages @languages end |
#layout ⇒ Object
Returns the value of attribute layout.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def layout @layout end |
#link_extension ⇒ Object
Returns the value of attribute link_extension.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def link_extension @link_extension end |
#locale ⇒ Object
Returns the value of attribute locale.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def locale @locale end |
#markup ⇒ Object
Returns the value of attribute markup.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def markup @markup end |
#rails ⇒ Object Also known as: rails?
Returns the value of attribute rails.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def rails @rails end |
#reload_dsl=(value) ⇒ Object (writeonly)
Sets the attribute reload_dsl
11 12 13 |
# File 'lib/apipie_dsl/configuration.rb', line 11 def reload_dsl=(value) @reload_dsl = value end |
#sections ⇒ Object
Returns the value of attribute sections.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def sections @sections end |
#translate ⇒ Object
Returns the value of attribute translate.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def translate @translate end |
#use_cache ⇒ Object Also known as: use_cache?
Returns the value of attribute use_cache.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def use_cache @use_cache end |
#validate ⇒ Object Also known as: validate?
Returns the value of attribute validate.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def validate @validate end |
#validate_value ⇒ Object Also known as: validate_value?
27 28 29 |
# File 'lib/apipie_dsl/configuration.rb', line 27 def validate_value (validate? && @validate_value) end |
#version_in_url ⇒ Object
Returns the value of attribute version_in_url.
5 6 7 |
# File 'lib/apipie_dsl/configuration.rb', line 5 def version_in_url @version_in_url end |
Instance Method Details
#reload_dsl? ⇒ Boolean
52 53 54 55 56 57 58 59 |
# File 'lib/apipie_dsl/configuration.rb', line 52 def reload_dsl? @reload_dsl = if rails? Rails.env.development? else @reload_dsl end @reload_dsl && !dsl_classes_matchers.empty? end |