Class: Arc42Pandoc::ApiaryBuilder
- Inherits:
-
Object
- Object
- Arc42Pandoc::ApiaryBuilder
- Defined in:
- lib/arc42-pandoc/apiary/apiary_builder.rb
Instance Method Summary collapse
- #create(output, options = {}) ⇒ Object
-
#initialize ⇒ ApiaryBuilder
constructor
A new instance of ApiaryBuilder.
- #list ⇒ Object
Constructor Details
#initialize ⇒ ApiaryBuilder
Returns a new instance of ApiaryBuilder.
7 8 9 |
# File 'lib/arc42-pandoc/apiary/apiary_builder.rb', line 7 def initialize end |
Instance Method Details
#create(output, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/arc42-pandoc/apiary/apiary_builder.rb', line 11 def create(output, = {}) = () template = find_template([:template], [:language]) abort "The template is not available for the language '#{[:language]}'. Check 'apiary list' for available templates." unless File.file?(template) ruyml = Ruyml::Data.new() ruyml.render_file(template, output) end |
#list ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/arc42-pandoc/apiary/apiary_builder.rb', line 21 def list files = Dir[File.join(dirname, 'templates', '**/*')].select { |file| File.file?(file) } chunks = files.group_by { |file| file.split('/')[-2] } chunks.each { |lang, templates| puts "Templates available for language '#{lang}': \n * #{templates.map { |t| t.split('/')[-1] }.join("\n * ")}\n\n" } end |