Exception: Sndfile::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/sndfile/error.rb

Overview

Exception raised in case of errors from libsndfile. The message contains the libsndfile error message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Error

Returns a new instance of Error.



10
11
12
13
14
15
# File 'lib/sndfile/error.rb', line 10

def initialize(args)
  args = args.keyword_args(:description, :code, :file)
  @description = args.description
  @code = args.code
  @file = args.file
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



8
9
10
# File 'lib/sndfile/error.rb', line 8

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/sndfile/error.rb', line 7

def description
  @description
end

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/sndfile/error.rb', line 9

def file
  @file
end

Instance Method Details

#to_sObject



17
18
19
20
21
22
23
# File 'lib/sndfile/error.rb', line 17

def to_s
  s = ""
  s << @description if @description
  s << " (#{@code})" if @code
  s << " [#{@file}]" if @file
  s
end