Class: Jamming::Chord
- Inherits:
-
Object
- Object
- Jamming::Chord
- Defined in:
- lib/jamming/chord.rb
Instance Attribute Summary collapse
-
#frets ⇒ Object
readonly
Returns the value of attribute frets.
Instance Method Summary collapse
-
#initialize(chord_as_string) ⇒ Chord
constructor
A new instance of Chord.
- #name ⇒ Object
- #to_png(options = {}) ⇒ Object
Constructor Details
#initialize(chord_as_string) ⇒ Chord
Returns a new instance of Chord.
8 9 10 |
# File 'lib/jamming/chord.rb', line 8 def initialize(chord_as_string) @frets = parse(chord_as_string) end |
Instance Attribute Details
#frets ⇒ Object (readonly)
Returns the value of attribute frets.
6 7 8 |
# File 'lib/jamming/chord.rb', line 6 def frets @frets end |
Instance Method Details
#name ⇒ Object
17 18 19 |
# File 'lib/jamming/chord.rb', line 17 def name Jamming::Dictionary.name_for(frets) end |
#to_png(options = {}) ⇒ Object
12 13 14 15 |
# File 'lib/jamming/chord.rb', line 12 def to_png( = {}) label = [:label] == false ? nil : [:label] || name Jamming::PNGFormatter.new(frets).print(.merge(:label => label)) end |