Class: Jamming::PNGFormatter
- Inherits:
-
Object
- Object
- Jamming::PNGFormatter
- Defined in:
- lib/jamming/png_formatter.rb
Overview
Formats a single fingering as png data
Instance Method Summary collapse
-
#initialize(frets) ⇒ PNGFormatter
constructor
A new instance of PNGFormatter.
- #print(options = {}) ⇒ Object
Constructor Details
#initialize(frets) ⇒ PNGFormatter
Returns a new instance of PNGFormatter.
8 9 10 11 |
# File 'lib/jamming/png_formatter.rb', line 8 def initialize(frets) @frets = frets @strings = ["E", "A", "D", "G", "B", "e"] end |
Instance Method Details
#print(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jamming/png_formatter.rb', line 13 def print(={}) @label = [:label] @max_fret = @frets.compact.max @min_fret = @frets.compact.delete_if { |f| f == 0 }.min @min_fret = 1 if @max_fret <= 4 @number_of_frets = [@max_fret - @min_fret + 1, 4].max get_png_data end |