Class: OutroRails::Instruments::Guitar::ChordShapes::Shape

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

Overview

One grip in the library. See the module comment for what each field means; instances are frozen by .shape below.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fretsObject

Returns the value of attribute frets

Returns:

  • (Object)

    the current value of frets



35
36
37
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 35

def frets
  @frets
end

#movable_omitObject

Returns the value of attribute movable_omit

Returns:

  • (Object)

    the current value of movable_omit



35
36
37
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 35

def movable_omit
  @movable_omit
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



35
36
37
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 35

def name
  @name
end

#root_stringObject

Returns the value of attribute root_string

Returns:

  • (Object)

    the current value of root_string



35
36
37
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 35

def root_string
  @root_string
end

Instance Method Details

#caged_letterObject

The CAGED family this shape descends from: :am7 => "A", :d_sus2 => "D". Shape names are spelled from their namesake chord, so the first character is always the family letter.



53
54
55
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 53

def caged_letter
  name.to_s[0].upcase
end

#movable_fretsObject

The grip as barred up the neck, without the omitted strings



46
47
48
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 46

def movable_frets
  frets.reject { |string, _| movable_omit.include?(string) }
end

#root_fretObject

Fret played on the root string in open position



41
42
43
# File 'lib/outro_rails/instruments/guitar/chord_shapes.rb', line 41

def root_fret
  frets.fetch(root_string)
end