Class: Faker::Music
- Defined in:
- lib/faker/music/opera.rb,
lib/faker/music/rush.rb,
lib/faker/music/music.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/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: 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.
115 116 117 |
# File 'lib/faker/music/music.rb', line 115 def album fetch('music.albums') end |
.band ⇒ String
Produces the name of a band.
102 103 104 |
# File 'lib/faker/music/music.rb', line 102 def band fetch('music.bands') end |
.chord ⇒ String
Produces the name of a chord, using letter notation.
33 34 35 |
# File 'lib/faker/music/music.rb', line 33 def chord key + sample(chord_types) end |
.chord_types ⇒ Array<String>
Produces an array of types of chords.
89 90 91 |
# File 'lib/faker/music/music.rb', line 89 def chord_types CHORD_TYPES end |
.genre ⇒ String
Produces the name of a musical genre.
128 129 130 |
# File 'lib/faker/music/music.rb', line 128 def genre fetch('music.genres') end |
.instrument ⇒ String
Produces the name of an instrument.
46 47 48 |
# File 'lib/faker/music/music.rb', line 46 def instrument fetch('music.instruments') end |
.key ⇒ String
Produces the name of a key/note, using letter notation.
20 21 22 |
# File 'lib/faker/music/music.rb', line 20 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).
79 80 81 |
# File 'lib/faker/music/music.rb', line 79 def key_types KEY_TYPES end |
.key_variants ⇒ Array<String>
Produces an array of accidentals (with “natural” denoted as an empty string).
66 67 68 |
# File 'lib/faker/music/music.rb', line 66 def key_variants ACCIDENTAL_SIGNS end |
.keys ⇒ Array<String>
Produces an array of the letter names of musical notes, without accidentals.
56 57 58 |
# File 'lib/faker/music/music.rb', line 56 def keys NOTE_LETTERS end |
.mambo_no_5 ⇒ String
Produces a name from Lou Bega’s Mambo #5
140 141 142 |
# File 'lib/faker/music/music.rb', line 140 def mambo_no_5 fetch('music.mambo_no_5') end |