Class: WTFChord::Formatters::Base
- Inherits:
-
Object
- Object
- WTFChord::Formatters::Base
- Extended by:
- Forwardable
- Defined in:
- lib/wtf_chord/formatters/base.rb
Constant Summary collapse
- FRETS =
6
Class Method Summary collapse
Instance Method Summary collapse
- #actual_strings ⇒ Object
- #draw ⇒ Object
-
#initialize(fret, with_rates = false) ⇒ Base
constructor
A new instance of Base.
- #with_rates? ⇒ Boolean
Constructor Details
#initialize(fret, with_rates = false) ⇒ Base
Returns a new instance of Base.
28 29 30 31 |
# File 'lib/wtf_chord/formatters/base.rb', line 28 def initialize(fret, with_rates = false) @fret = fret @with_rates = !!with_rates end |
Class Method Details
.separator ⇒ Object
13 14 15 |
# File 'lib/wtf_chord/formatters/base.rb', line 13 def self.separator "\n" end |
.to_proc ⇒ Object
17 18 19 |
# File 'lib/wtf_chord/formatters/base.rb', line 17 def self.to_proc proc { |fret| new(fret, Thread.current[:with_rates]).draw } end |
.with_rates(value = false) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/wtf_chord/formatters/base.rb', line 21 def self.with_rates(value = false) Thread.current[:with_rates], with_rates_was = !!value, !!Thread.current[:with_rates] yield(self) ensure Thread.current[:with_rates] = with_rates_was end |
Instance Method Details
#actual_strings ⇒ Object
36 37 38 |
# File 'lib/wtf_chord/formatters/base.rb', line 36 def actual_strings strings.reject(&:dead?) end |
#draw ⇒ Object
33 34 |
# File 'lib/wtf_chord/formatters/base.rb', line 33 def draw end |
#with_rates? ⇒ Boolean
40 41 42 |
# File 'lib/wtf_chord/formatters/base.rb', line 40 def with_rates? !!@with_rates end |