Class: OutroRails::Instruments::Guitar::Tunings::Tuning

Inherits:
Struct
  • Object
show all
Defined in:
lib/outro_rails/instruments/guitar/tunings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



10
11
12
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 10

def name
  @name
end

#notesObject

Returns the value of attribute notes

Returns:

  • (Object)

    the current value of notes



10
11
12
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 10

def notes
  @notes
end

#preferObject

Returns the value of attribute prefer

Returns:

  • (Object)

    the current value of prefer



10
11
12
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 10

def prefer
  @prefer
end

#slugObject

Returns the value of attribute slug

Returns:

  • (Object)

    the current value of slug



10
11
12
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 10

def slug
  @slug
end

Instance Method Details

#labelObject

"Drop D - D A D G B E"



26
27
28
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 26

def label
  "#{name} - #{letters.join(' ')}"
end

#lettersObject

Open-string letters without octaves, low to high: %w[D A D G B E]



21
22
23
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 21

def letters
  notes.map { |note| note.sub(/-?\d+\z/, "") }
end

#standard?Boolean

True only for the tuning we fall back to when none is given.

Returns:

  • (Boolean)


16
17
18
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 16

def standard?
  slug == "standard"
end

#to_sObject

Interpolates as the display name: "#tuning" => "Drop D"



31
32
33
# File 'lib/outro_rails/instruments/guitar/tunings.rb', line 31

def to_s
  name
end