Class: Faker::Music

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/music.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, sample, shuffle, translate, unique, with_locale

Class Method Details

.chordObject


8
9
10
# File 'lib/faker/music.rb', line 8

def chord
  key + sample(chord_types)
end

.chord_typesObject


28
29
30
# File 'lib/faker/music.rb', line 28

def chord_types
  ['', 'maj', '6', 'maj7', 'm', 'm7', '-7', '7', 'dom7', 'dim', 'dim7', 'm7b5']
end

.instrumentObject


12
13
14
# File 'lib/faker/music.rb', line 12

def instrument
  fetch('music.instruments')
end

.keyObject


4
5
6
# File 'lib/faker/music.rb', line 4

def key
  sample(keys) + sample(key_variants)
end

.key_typesObject


24
25
26
# File 'lib/faker/music.rb', line 24

def key_types
  ['', 'm']
end

.key_variantsObject


20
21
22
# File 'lib/faker/music.rb', line 20

def key_variants
  ['b', '#', '']
end

.keysObject


16
17
18
# File 'lib/faker/music.rb', line 16

def keys
  ['C', 'D', 'E', 'F', 'G', 'A', 'B']
end