class Faker::Music

A generator of titles of operas by Verdi, Rossini, Donizetti and Bellini

Constants

ACCIDENTAL_SIGNS
CHORD_TYPES
KEY_TYPES
NOTE_LETTERS

Public Class Methods

album() click to toggle source

Produces the name of an album.

@return [String]

@example

Faker::Music.album #=> "Sgt. Pepper's Lonely Hearts Club"

@faker.version 1.9.1

# File lib/faker/music/music.rb, line 115
def album
  fetch('music.albums')
end
band() click to toggle source

Produces the name of a band.

@return [String]

@example

Faker::Music.band #=> "The Beatles"

@faker.version 1.9.1

# File lib/faker/music/music.rb, line 102
def band
  fetch('music.bands')
end
chord() click to toggle source

Produces the name of a chord, using letter notation.

@return [String]

@example

Faker::Music.chord #=> "Adim7"

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 33
def chord
  key + sample(chord_types)
end
chord_types() click to toggle source

Produces an array of types of chords.

@return [Array<String>]

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 89
def chord_types
  CHORD_TYPES
end
genre() click to toggle source

Produces the name of a musical genre.

@return [String]

@example

Faker::Music.genre #=> "Rock"

@faker.version 1.9.1

# File lib/faker/music/music.rb, line 128
def genre
  fetch('music.genres')
end
instrument() click to toggle source

Produces the name of an instrument.

@return [String]

@example

Faker::Music.instrument #=> "Acoustic Guitar"

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 46
def instrument
  fetch('music.instruments')
end
key() click to toggle source

Produces the name of a key/note, using letter notation.

@return [String]

@example

Faker::Music.key #=> "A#"

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 20
def key
  sample(keys) + sample(key_variants)
end
key_types() click to toggle source

Produces an array of key types (with “major” denoted as an empty string).

@return [Array<String>]

@example

Faker::Music.key_types #=> ['', 'm']

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 79
def key_types
  KEY_TYPES
end
key_variants() click to toggle source

Produces an array of accidentals (with “natural” denoted as an empty string).

@return [Array<String>]

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 66
def key_variants
  ACCIDENTAL_SIGNS
end
keys() click to toggle source

Produces an array of the letter names of musical notes, without accidentals.

@return [Array<String>]

@faker.version 1.6.4

# File lib/faker/music/music.rb, line 56
def keys
  NOTE_LETTERS
end