Class: Relaton::Cli::BaseConvertor

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton/cli/base_convertor.rb

Direct Known Subclasses

XMLConvertor, YAMLConvertor

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, options = {}) ⇒ BaseConvertor

Returns a new instance of BaseConvertor.



9
10
11
12
13
14
15
16
# File 'lib/relaton/cli/base_convertor.rb', line 9

def initialize(file, options = {})
  @file = file
  @options = options
  @outdir = options.fetch(:outdir, nil)
  @writable = options.fetch(:write, true)

  install_dependencies(options[:require] || [])
end

Class Method Details

.to_html(file, style, template) ⇒ Object

Convert to HTML

This interface expect us to provide Relaton collection XML as XML/RXL, and necessary styels / templates then it will be used convert that collection to HTML.

Parameters:

  • file (String)

    Relaton collection file path

  • style (String)

    Stylesheet file path for styles

  • template (String)

    The liquid tempalte directory



33
34
35
# File 'lib/relaton/cli/base_convertor.rb', line 33

def self.to_html(file, style, template)
  new(file, style: style, template: template, extension: "html").to_html
end

Instance Method Details

#to_htmlObject



18
19
20
21
# File 'lib/relaton/cli/base_convertor.rb', line 18

def to_html
  content = convert_to_html
  write_to_a_file(content)
end