Class: LEWT::Metastat
- Defined in:
- lib/extensions/metastat/metastat.rb
Overview
The Metastat extension [experimental] handles processing meta-data added to ledger entries. It can compute statistics based of these parsed values
Usage:
Here is an example ‘description’ field entered into a LEWTLedger which can be parsed with Metastat
'description' => 'Adding some features to the system #happiness=10 #average-pay'
Metastat will extract the # tags from the above string and log an indicatior called happinesswhich is equal to 10 and a Boolean switch average-pay will be set to true
These values will be aggregate over the whole ‘extract’ dataset then processed in a few ways.
-
Create a graph out of the data
-
Create a summary table out of the data
Instance Attribute Summary collapse
-
#client_graph ⇒ Object
readonly
Returns the value of attribute client_graph.
-
#client_table ⇒ Object
readonly
Returns the value of attribute client_table.
Attributes inherited from Extension
#command_name, #customers, #enterprise, #lewt_settings, #lewt_stash, #options
Instance Method Summary collapse
-
#initialize ⇒ Metastat
constructor
Sets up this extension and registers its options.
-
#process(options, extract_data) ⇒ Object
- Handles the process event for this extension options [Hash]
-
The options hash passed to this function by the Lewt program.
Methods inherited from Extension
#get_matched_customers, #lewt_extensions
Constructor Details
#initialize ⇒ Metastat
Sets up this extension and registers its options
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/extensions/metastat/metastat.rb', line 31 def initialize = { :tags => { :definition => "A comma seperated list of metatags to lookup.", :type => String }, :y_series => { :definition => "An optional y series to use for a correlation analysis.", :type => String } } @boolean_table = Hash.new @raw_data = Hash.new @dataset = Hash.new super({:cmd => 'metastat', :options => }) end |
Instance Attribute Details
#client_graph ⇒ Object (readonly)
Returns the value of attribute client_graph.
28 29 30 |
# File 'lib/extensions/metastat/metastat.rb', line 28 def client_graph @client_graph end |
#client_table ⇒ Object (readonly)
Returns the value of attribute client_table.
28 29 30 |
# File 'lib/extensions/metastat/metastat.rb', line 28 def client_table @client_table end |
Instance Method Details
#process(options, extract_data) ⇒ Object
Handles the process event for this extension
- options [Hash]
-
The options hash passed to this function by the Lewt program.
- extract_data [LEWTBook]
-
The data in LEWTBook format
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/extensions/metastat/metastat.rb', line 51 def process (, extract_data) @options = extract_data.each do |row| filter_row_values(row, ) end @dataset["frequency_table"] = @boolean_table if [:y_series] @dataset["correlations"] = compute_correlations @raw_data end return @dataset end |