Class: OutroRails::Theory::Scale::DiatonicChord

Inherits:
Struct
  • Object
show all
Defined in:
lib/outro_rails/theory/scale.rb

Overview

A triad built on a scale degree, with its display forms.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#degreeObject

Returns the value of attribute degree

Returns:

  • (Object)

    the current value of degree



45
46
47
# File 'lib/outro_rails/theory/scale.rb', line 45

def degree
  @degree
end

#qualityObject

Returns the value of attribute quality

Returns:

  • (Object)

    the current value of quality



45
46
47
# File 'lib/outro_rails/theory/scale.rb', line 45

def quality
  @quality
end

#rootObject

Returns the value of attribute root

Returns:

  • (Object)

    the current value of root



45
46
47
# File 'lib/outro_rails/theory/scale.rb', line 45

def root
  @root
end

Instance Method Details

#in_library?Boolean

Whether the chord library has this root - the app only generates chords for NoteName::CANONICAL_ROOTS, so degrees spelled with double accidentals or E#/B#-style names (F# major's E#dim) have no library page to link to.

Returns:

  • (Boolean)


63
64
65
# File 'lib/outro_rails/theory/scale.rb', line 63

def in_library?
  NoteName::CANONICAL_ROOTS.include?(root.to_s)
end

#nashvilleObject

Key-agnostic arabic form, e.g. "2m"



68
69
70
# File 'lib/outro_rails/theory/scale.rb', line 68

def nashville
  NashvilleNumber.format(degree: degree, quality: quality)
end

#romanObject

Key-agnostic roman form, e.g. "ii"



73
74
75
# File 'lib/outro_rails/theory/scale.rb', line 73

def roman
  NashvilleNumber.roman(degree: degree, quality: quality)
end

#slugObject

URL slug matching Chord#slug in the chord library.



55
56
57
# File 'lib/outro_rails/theory/scale.rb', line 55

def slug
  ChordVocabulary.slug(symbol)
end

#symbolObject

The chord symbol, e.g. "Dm"



50
51
52
# File 'lib/outro_rails/theory/scale.rb', line 50

def symbol
  ChordVocabulary.symbol(root_name: root, quality: quality)
end