Module: Nodepile::GrossActions

Defined in:
lib/nodepile/gross_actions.rb

Overview

A set of large scale, batch-like operations

Class Method Summary collapse

Class Method Details

.render_to_file(output_filepath, *input_filepaths) ⇒ Object

Given an output filepath and one or more tabular datafile inputs, render the visualization of the input datafiles.

Parameters:

  • output_filepath (String)

    location where the output file should be written. Note, if the file already exists it will be overwritten. Note that the file suffix indicates the output format that will be used. Valid extensions are: jpg, dot, gif, svg, png, json, pdf

  • input_filepaths (Array<String>)

    One or more input files. Note that the program will take a best guess at the text file format with file suffix (csv, tsv) being the a strong signal. The order of the filenames is used as their load order.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nodepile/gross_actions.rb', line 23

def self.render_to_file(output_filepath, *input_filepaths)
    pile = Nodepile::PileOrganizer.new
    gviz = Nodepile::GraphVisualizer.new
    input_filepaths.each{|fpath|
        raise "File not found: #{fpath}" unless File.exist?(fpath)
        pile.load_from_file(fpath)
        gviz.load(pile.node_records,pile.edge_records,configs: pile.pragmas)
        gviz.emit_file(output_filepath,configs: pile.pragmas)
       }
    return nil  # for now, return is meaningless
end