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.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/apipie_dsl/configuration.rb', line 74

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
  @reload_dsl = nil
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:



21
22
23
24
25
26
# File 'lib/apipie_dsl/configuration.rb', line 21

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_class_descriptionObject

Returns the value of attribute default_class_description.



13
14
15
# File 'lib/apipie_dsl/configuration.rb', line 13

def default_class_description
  @default_class_description
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



64
65
66
# File 'lib/apipie_dsl/configuration.rb', line 64

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



46
47
48
49
50
51
# File 'lib/apipie_dsl/configuration.rb', line 46

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]



36
37
38
39
# File 'lib/apipie_dsl/configuration.rb', line 36

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?



28
29
30
# File 'lib/apipie_dsl/configuration.rb', line 28

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)


53
54
55
56
57
58
59
60
61
62
# File 'lib/apipie_dsl/configuration.rb', line 53

def reload_dsl?
  return @reload_dsl unless @reload_dsl.nil?

  @reload_dsl = if rails?
                  Rails.env.development?
                else
                  @reload_dsl
                end
  @reload_dsl && !dsl_classes_matchers.empty?
end