Class: Stringed::Formatters::ASCIIString
- Inherits:
-
Object
- Object
- Stringed::Formatters::ASCIIString
- Includes:
- ASCII
- Defined in:
- lib/stringed/formatters.rb
Instance Method Summary collapse
- #fret_numbers ⇒ Object
-
#initialize(string, options) ⇒ ASCIIString
constructor
A new instance of ASCIIString.
- #to_s ⇒ Object
Methods included from ASCII
Constructor Details
#initialize(string, options) ⇒ ASCIIString
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/stringed/formatters.rb', line 16 def initialize(string,) @selected_frets = .fetch(:selected_frets,[]) @output = "#{string.to_s} |" @string = string @string.frets.each do |fret| if @selected_frets.include?(fret) then @output << "--x--|" else @output << "-----|" end end @output << "\n" @output << fret_numbers if .has_key? :numbered_frets end |
Instance Method Details
#fret_numbers ⇒ Object
31 32 33 |
# File 'lib/stringed/formatters.rb', line 31 def fret_numbers ASCII.fret_numbers(@string) end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/stringed/formatters.rb', line 35 def to_s @output end |