pkgnet icon indicating copy to clipboard operation
pkgnet copied to clipboard

Reporter object pretty print

Open jayqi opened this issue 6 years ago • 0 comments

R6 classes let you define a custom $print method.

Right now we're using the default R6 printing which just dumps a list of public and private members.

I think it would be much more useful to display, for example:

  • the name of the package
  • what results are cached or not yet generated.
  • number of nodes and edges
  • configurable options like layout, color palette

For reference, here is the existing print:

library(pkgnet)
foo <- FunctionReporter$new()
foo$set_package('baseballstats')
#> INFO [2018-12-18 22:25:24] Checking installed packages...
#> INFO [2018-12-18 22:25:24] Found 'baseballstats' in installed packages.
#> INFO [2018-12-18 22:25:24] Resetting cached network information...
foo
#> <FunctionReporter>
#>   Inherits from: <AbstractGraphReporter>
#>   Public:
#>     clone: function (deep = FALSE) 
#>     edges: active binding
#>     get_summary_view: function () 
#>     graph_viz: active binding
#>     layout_type: active binding
#>     network_measures: active binding
#>     nodes: active binding
#>     pkg_graph: active binding
#>     pkg_name: active binding
#>     pkg_R6_classes: active binding
#>     pkg_R6_inheritance: active binding
#>     pkg_R6_methods: active binding
#>     report_markdown_path: active binding
#>     set_package: function (pkg_name, pkg_path = NULL) 
#>   Private:
#>     cache: list
#>     calculate_network_measures: function () 
#>     calculate_test_coverage: function () 
#>     extract_edges: function () 
#>     extract_network: function () 
#>     extract_nodes: function () 
#>     get_pkg_env: function () 
#>     make_graph_object: function () 
#>     pkg_path: NULL
#>     plot_network: function () 
#>     plotNodeColorScheme: list
#>     private_layout_type: layout_with_graphopt
#>     private_pkg_name: baseballstats
#>     reset_cache: function () 
#>     reset_graph_viz: function () 
#>     set_plot_node_color_scheme: function (field, palette) 
#>     update_nodes: function (metadataDT) 
#>     validate_pkg_name: function (pkg_name)

Created on 2018-12-18 by the reprex package (v0.2.1)

jayqi avatar Dec 19 '18 04:12 jayqi