Module: RestApiDoc::Config
- Included in:
- RestApiDoc
- Defined in:
- lib/restapi_doc/config.rb
Instance Method Summary collapse
- #asset_dir ⇒ Object
- #config_dir(f = nil) ⇒ Object
- #config_template_dir(f = nil) ⇒ Object
- #controller_dir(f = nil) ⇒ Object
- #form_file_name(dir, file) ⇒ Object
- #target_dir(f = nil) ⇒ Object
- #temp_dir(f = nil) ⇒ Object
- #template_dir(f = nil) ⇒ Object
Instance Method Details
#asset_dir ⇒ Object
14 15 16 |
# File 'lib/restapi_doc/config.rb', line 14 def asset_dir @asset_dir ||= File.join(File.dirname(__FILE__), 'template/assets') end |
#config_dir(f = nil) ⇒ Object
18 19 20 21 |
# File 'lib/restapi_doc/config.rb', line 18 def config_dir(f = nil) @config_dir ||= File.join(::Rails.root.to_s, 'config/restapi_doc') form_file_name @config_dir, f end |
#config_template_dir(f = nil) ⇒ Object
9 10 11 12 |
# File 'lib/restapi_doc/config.rb', line 9 def config_template_dir(f = nil) @template_dir ||= File.join(File.dirname(__FILE__), 'config') form_file_name @template_dir, f end |
#controller_dir(f = nil) ⇒ Object
28 29 30 31 |
# File 'lib/restapi_doc/config.rb', line 28 def controller_dir(f = nil) @controller_dir ||= File.join(::Rails.root.to_s, 'app/controllers/') form_file_name @controller_dir, f end |
#form_file_name(dir, file) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/restapi_doc/config.rb', line 38 def form_file_name(dir, file) case file when NilClass then dir when String then File.join(dir, file) else raise ArgumentError, "Invalid argument #{file}" end end |
#target_dir(f = nil) ⇒ Object
23 24 25 26 |
# File 'lib/restapi_doc/config.rb', line 23 def target_dir(f = nil) @target_dir ||= File.join(::Rails.root.to_s, 'public/apidoc/') form_file_name @target_dir, f end |
#temp_dir(f = nil) ⇒ Object
33 34 35 36 |
# File 'lib/restapi_doc/config.rb', line 33 def temp_dir(f = nil) @temp_dir ||= "#{Dir.mktmpdir("apidoc")}/" form_file_name @temp_dir, f end |
#template_dir(f = nil) ⇒ Object
4 5 6 7 |
# File 'lib/restapi_doc/config.rb', line 4 def template_dir(f = nil) @template_dir ||= File.join(File.dirname(__FILE__), 'template') form_file_name @template_dir, f end |