Class: HanselCore::OctaveFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/hansel/formatting/octave_formatter.rb

Overview

Output to a Octave script.

Instance Method Summary collapse

Constructor Details

#initialize(data, options = {}) ⇒ OctaveFormatter

Returns a new instance of OctaveFormatter.



8
9
10
11
12
13
14
15
# File 'lib/hansel/formatting/octave_formatter.rb', line 8

def initialize(data, options = {})
  @data         = data
  @template     = options[:template]
  @rates        = @data.map &:rate
  @max_rate     = @rates.max
  @png_output   = options[:png_file_name]
  @description  = options[:description]
end

Instance Method Details

#formatObject

For each value of rate, collate the values in each variable in @vars and format using the erb template



19
20
21
# File 'lib/hansel/formatting/octave_formatter.rb', line 19

def format
  ERB.new(File.read(@template)).result binding
end