Class: Faker::Music
- Defined in:
- lib/faker/music/opera.rb,
lib/faker/music.rb,
lib/faker/music/rush.rb,
lib/faker/music/phish.rb,
lib/faker/music/hiphop.rb,
lib/faker/music/prince.rb,
lib/faker/music/pearl_jam.rb,
lib/faker/music/rock_band.rb,
lib/faker/music/bossa_nova.rb,
lib/faker/music/grateful_dead.rb,
lib/faker/music/umphreys_mcgee.rb,
lib/faker/music/smashing_pumpkins.rb
Overview
A generator of titles of operas by various composers
Defined Under Namespace
Classes: BossaNova, GratefulDead, Hiphop, Opera, PearlJam, Phish, Prince, RockBand, Rush, SmashingPumpkins, UmphreysMcgee
Constant Summary collapse
- NOTE_LETTERS =
%w[C D E F G A B].freeze
- ACCIDENTAL_SIGNS =
['b', '#', ''].freeze
- KEY_TYPES =
['', 'm'].freeze
- CHORD_TYPES =
['', 'maj', '6', 'maj7', 'm', 'm7', '-7', '7', 'dom7', 'dim', 'dim7', 'm7b5'].freeze
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.album ⇒ String
Produces the name of an album.
-
.band ⇒ String
Produces the name of a band.
-
.chord ⇒ String
Produces the name of a chord, using letter notation.
-
.chord_types ⇒ Array<String>
Produces an array of types of chords.
-
.genre ⇒ String
Produces the name of a musical genre.
-
.instrument ⇒ String
Produces the name of an instrument.
-
.key ⇒ String
Produces the name of a key/note, using letter notation.
-
.key_types ⇒ Array<String>
Produces an array of key types (with “major” denoted as an empty string).
-
.key_variants ⇒ Array<String>
Produces an array of accidentals (with “natural” denoted as an empty string).
-
.keys ⇒ Array<String>
Produces an array of the letter names of musical notes, without accidentals.
-
.mambo_no_5 ⇒ String
Produces a name from Lou Bega’s Mambo #5.
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale
Class Method Details
.album ⇒ String
Produces the name of an album.
119 120 121 |
# File 'lib/faker/music.rb', line 119 def album fetch('music.albums') end |
.band ⇒ String
Produces the name of a band.
106 107 108 |
# File 'lib/faker/music.rb', line 106 def band fetch('music.bands') end |
.chord ⇒ String
Produces the name of a chord, using letter notation.
37 38 39 |
# File 'lib/faker/music.rb', line 37 def chord key + sample(chord_types) end |
.chord_types ⇒ Array<String>
Produces an array of types of chords.
93 94 95 |
# File 'lib/faker/music.rb', line 93 def chord_types CHORD_TYPES end |
.genre ⇒ String
Produces the name of a musical genre.
132 133 134 |
# File 'lib/faker/music.rb', line 132 def genre fetch('music.genres') end |
.instrument ⇒ String
Produces the name of an instrument.
50 51 52 |
# File 'lib/faker/music.rb', line 50 def instrument fetch('music.instruments') end |
.key ⇒ String
Produces the name of a key/note, using letter notation.
24 25 26 |
# File 'lib/faker/music.rb', line 24 def key sample(keys) + sample(key_variants) end |
.key_types ⇒ Array<String>
Produces an array of key types (with “major” denoted as an empty string).
83 84 85 |
# File 'lib/faker/music.rb', line 83 def key_types KEY_TYPES end |
.key_variants ⇒ Array<String>
Produces an array of accidentals (with “natural” denoted as an empty string).
70 71 72 |
# File 'lib/faker/music.rb', line 70 def key_variants ACCIDENTAL_SIGNS end |
.keys ⇒ Array<String>
Produces an array of the letter names of musical notes, without accidentals.
60 61 62 |
# File 'lib/faker/music.rb', line 60 def keys NOTE_LETTERS end |
.mambo_no_5 ⇒ String
Produces a name from Lou Bega’s Mambo #5
144 145 146 |
# File 'lib/faker/music.rb', line 144 def mambo_no_5 fetch('music.mambo_no_5') end |