Class: DocMyRoutes::Config
- Inherits:
-
Object
- Object
- DocMyRoutes::Config
- Defined in:
- lib/doc_my_routes/doc/config.rb
Overview
Inner class to maintain configuration settings
Defined Under Namespace
Classes: UnsupportedFormat
Instance Attribute Summary collapse
-
#css_file_path ⇒ Object
Project title.
-
#description ⇒ Object
Project title.
-
#destination_dir ⇒ Object
Project title.
-
#examples_path_regexp ⇒ Object
Project title.
-
#format ⇒ Object
Template used for the index.html.
-
#index_template_file ⇒ Object
readonly
Template used for the index.html.
-
#partial_template_file ⇒ Object
readonly
Template used for the index.html.
-
#title ⇒ Object
Project title.
Instance Method Summary collapse
-
#destination_css ⇒ Object
Calculate the relative path of the CSS used.
- #examples ⇒ Object
- #index_file ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/doc_my_routes/doc/config.rb', line 26 def initialize @title = @description = @examples_path_regexp = nil @destination_dir = File.join(Dir.pwd, 'doc', 'api') @format = :html @partial = false default_static_path = File.join(File.dirname(__FILE__), '..', '..', '..', 'etc') @css_file_path = File.join(default_static_path, 'css', 'base.css') @index_template_file = File.join(default_static_path, 'index.html.erb') @partial_template_file = File.join(default_static_path, 'partial.html.erb') end |
Instance Attribute Details
#css_file_path ⇒ Object
Project title
17 18 19 |
# File 'lib/doc_my_routes/doc/config.rb', line 17 def css_file_path @css_file_path end |
#description ⇒ Object
Project title
17 18 19 |
# File 'lib/doc_my_routes/doc/config.rb', line 17 def description @description end |
#destination_dir ⇒ Object
Project title
17 18 19 |
# File 'lib/doc_my_routes/doc/config.rb', line 17 def destination_dir @destination_dir end |
#examples_path_regexp ⇒ Object
Project title
17 18 19 |
# File 'lib/doc_my_routes/doc/config.rb', line 17 def examples_path_regexp @examples_path_regexp end |
#format ⇒ Object
Template used for the index.html
22 23 24 |
# File 'lib/doc_my_routes/doc/config.rb', line 22 def format @format end |
#index_template_file ⇒ Object (readonly)
Template used for the index.html
22 23 24 |
# File 'lib/doc_my_routes/doc/config.rb', line 22 def index_template_file @index_template_file end |
#partial_template_file ⇒ Object (readonly)
Template used for the index.html
22 23 24 |
# File 'lib/doc_my_routes/doc/config.rb', line 22 def partial_template_file @partial_template_file end |
#title ⇒ Object
Project title
17 18 19 |
# File 'lib/doc_my_routes/doc/config.rb', line 17 def title @title end |
Instance Method Details
#destination_css ⇒ Object
Calculate the relative path of the CSS used
53 54 55 56 |
# File 'lib/doc_my_routes/doc/config.rb', line 53 def destination_css # TODO: make it more robust File.basename(@css_file_path) end |
#examples ⇒ Object
40 41 42 |
# File 'lib/doc_my_routes/doc/config.rb', line 40 def examples @examples_path_regexp.nil? ? [] : Dir.glob(@examples_path_regexp) end |
#index_file ⇒ Object
58 59 60 61 |
# File 'lib/doc_my_routes/doc/config.rb', line 58 def index_file filename = @partial ? 'index_partial.html' : 'index.html' File.join(@destination_dir, filename) end |