Sha256: 352a0fb72eb4033cfc379e9f40f2b7368893a3518abf1e873f062d26e8a79d46

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

require 'nodepile/gviz.rb'
require 'nodepile/pile_organizer.rb'

module Nodepile
  
# A set of large scale, batch-like operations   
module GrossActions
    
# Given an output filepath and one or more tabular datafile inputs, render
# the visualization of the input datafiles.
# @param 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
#            
# @param 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.
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 #render_to_file()
    
    
end #module GrossActions

end #module Nodepile

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nodepile-0.1.2 lib/nodepile/gross_actions.rb