Class: ApipieDSL::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/apipie_dsl/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_infoObject

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_nameObject

Returns the value of attribute app_name.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def app_name
  @app_name
end

#authenticateObject

Returns the value of attribute authenticate.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def authenticate
  @authenticate
end

#authorizeObject

Returns the value of attribute authorize.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def authorize
  @authorize
end

#autoload_methodsObject 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_dirObject

Raises:



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_namesObject 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

Returns the value of attribute copyright.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def copyright
  @copyright
end

#debugObject

Returns the value of attribute debug.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def debug
  @debug
end

#default_localeObject

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_sectionObject



61
62
63
# File 'lib/apipie_dsl/configuration.rb', line 61

def default_section
  @default_section || @sections.first
end

#default_versionObject

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_urlObject

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_pathObject

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_matcherObject

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_matchersObject



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_layoutObject

Returns the value of attribute help_layout.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def help_layout
  @help_layout
end

#ignoredObject

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

#languagesObject

Returns the value of attribute languages.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def languages
  @languages
end

#layoutObject

Returns the value of attribute layout.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def layout
  @layout
end

Returns the value of attribute link_extension.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def link_extension
  @link_extension
end

#localeObject

Returns the value of attribute locale.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def locale
  @locale
end

#markupObject

Returns the value of attribute markup.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def markup
  @markup
end

#railsObject 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

Parameters:

  • value

    the value to set the attribute reload_dsl to.



11
12
13
# File 'lib/apipie_dsl/configuration.rb', line 11

def reload_dsl=(value)
  @reload_dsl = value
end

#sectionsObject

Returns the value of attribute sections.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def sections
  @sections
end

#translateObject

Returns the value of attribute translate.



5
6
7
# File 'lib/apipie_dsl/configuration.rb', line 5

def translate
  @translate
end

#use_cacheObject 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

#validateObject 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_valueObject 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_urlObject

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

Returns:

  • (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