Class: HanselCore::OctaveFormatter
- Inherits:
-
Object
- Object
- HanselCore::OctaveFormatter
- Defined in:
- lib/hansel/formatting/octave_formatter.rb
Overview
Output to a Octave script.
Instance Method Summary collapse
-
#format ⇒ Object
For each value of rate, collate the values in each variable in @vars and format using the erb template.
-
#initialize(data, options = {}) ⇒ OctaveFormatter
constructor
A new instance of OctaveFormatter.
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, = {}) @data = data @template = [:template] @rates = @data.map &:rate @max_rate = @rates.max @png_output = [:png_file_name].gsub( '.', '_') # make latex happy @description = [:description] end |
Instance Method Details
#format ⇒ Object
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 |