Module: Apiary::Helpers
Defined Under Namespace
Modules: JavascriptHelper
Instance Method Summary
collapse
Instance Method Details
#api_description_source(path) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/apiary/helpers.rb', line 13
def api_description_source(path)
source_path = api_description_source_path(path)
source = nil
File.open(source_path, 'r:bom|utf-8') { |file| source = file.read }
source
end
|
#api_description_source_path(path) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/apiary/helpers.rb', line 5
def api_description_source_path(path)
raise "Invalid path #{path}" unless File.exist? path
return path if File.file? path
source_path = choose_one(path)
return source_path unless source_path.nil?
raise 'No API Description Document found'
end
|