module CarrierWave::AudioWaveform

Constants

VERSION

Public Instance Methods

waveform(options={}) click to toggle source
# File lib/carrierwave/audio_waveform.rb, line 19
def waveform options={}
  cache_stored_file! if !cached?

  image_filename = Waveformer.generate(current_path, options)
  File.rename image_filename, current_path

  if options[:type] == :svg
    self.file.instance_variable_set(:@content_type, "image/svg+xml")
  else
    self.file.instance_variable_set(:@content_type, "image/png")
  end
end
waveform_data(options={}) click to toggle source
# File lib/carrierwave/audio_waveform.rb, line 32
def waveform_data options={}
  cache_stored_file! if !cached?

  data_filename = WaveformData.generate(current_path, options)
  File.rename data_filename, current_path
  self.file.instance_variable_set(:@content_type, "application/json")
end