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
- #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.
26 27 28 29 |
# File 'lib/wtf_chord/formatters/base.rb', line 26 def initialize(fret, with_rates = false) @fret = fret @with_rates = !!with_rates end |
Class Method Details
.separator ⇒ Object
11 12 13 |
# File 'lib/wtf_chord/formatters/base.rb', line 11 def self.separator "\n".freeze end |
.to_proc ⇒ Object
15 16 17 |
# File 'lib/wtf_chord/formatters/base.rb', line 15 def self.to_proc proc { |fret| new(fret, Thread.current[:with_rates]).draw } end |
.with_rates(value = false) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/wtf_chord/formatters/base.rb', line 19 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
#draw ⇒ Object
31 32 |
# File 'lib/wtf_chord/formatters/base.rb', line 31 def draw end |
#with_rates? ⇒ Boolean
34 35 36 |
# File 'lib/wtf_chord/formatters/base.rb', line 34 def with_rates? !!@with_rates end |