Class: Noise

Inherits:
Object
  • Object
show all
Defined in:
lib/serinette/noise.rb

Constant Summary collapse

SOUND_DIRECTORY =
'./sounds/*'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNoise

Returns a new instance of Noise



7
8
9
10
11
12
# File 'lib/serinette/noise.rb', line 7

def initialize
  sound_files = Dir.glob(SOUND_DIRECTORY).sort
  num = (0..sound_files.length-1).to_a.sample

  @wavefile = sound_files[num]
end

Instance Attribute Details

#wavefileObject

Returns the value of attribute wavefile



5
6
7
# File 'lib/serinette/noise.rb', line 5

def wavefile
  @wavefile
end

Instance Method Details

#renderObject



14
15
16
# File 'lib/serinette/noise.rb', line 14

def render
  return @wavefile
end