Class: Relaton::Cli::BaseConvertor
- Inherits:
-
Object
- Object
- Relaton::Cli::BaseConvertor
- Defined in:
- lib/relaton/cli/base_convertor.rb
Direct Known Subclasses
Class Method Summary collapse
-
.to_html(file, style = nil, template = nil) ⇒ String
Convert to HTML.
Instance Method Summary collapse
-
#initialize(file, options = {}) ⇒ BaseConvertor
constructor
A new instance of BaseConvertor.
-
#to_html ⇒ String
HTML.
Constructor Details
#initialize(file, options = {}) ⇒ BaseConvertor
Returns a new instance of BaseConvertor.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/relaton/cli/base_convertor.rb', line 9 def initialize(file, = {}) @file = file @options = @outdir = .fetch(:outdir, nil) @writable = .fetch(:write, true) @overwrite = .fetch(:overwrite, true) @default_filelabel = 0 install_dependencies([:require] || []) end |
Class Method Details
.to_html(file, style = nil, template = nil) ⇒ String
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.
37 38 39 40 41 42 43 44 |
# File 'lib/relaton/cli/base_convertor.rb', line 37 def self.to_html(file, style = nil, template = nil) new( file, style: style || File.join(File.dirname(__FILE__), "../../../templates/index-style.css"), template: template || File.join(File.dirname(__FILE__), "../../../templates/"), extension: "html" ).to_html end |
Instance Method Details
#to_html ⇒ String
Returns HTML.
21 22 23 24 |
# File 'lib/relaton/cli/base_convertor.rb', line 21 def to_html content = convert_to_html write_to_a_file(content) end |