Class: Jamming::Chord

Inherits:
Object
  • Object
show all
Defined in:
lib/jamming/chord.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fretsObject (readonly)

Returns the value of attribute frets.



6
7
8
# File 'lib/jamming/chord.rb', line 6

def frets
  @frets
end

Instance Method Details

#nameObject



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(options = {})
  label = options[:label] == false ? nil : options[:label] || name
  Jamming::PNGFormatter.new(frets).print(options.merge(:label => label))
end