Exception: Uniword::ConversionError

Inherits:
Error
  • Object
show all
Defined in:
lib/uniword/errors.rb

Overview

Raised when a conversion between formats fails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_format, to_format, reason) ⇒ ConversionError

Returns a new instance of ConversionError.

Parameters:

  • from_format (Symbol)

    The source format

  • to_format (Symbol)

    The target format

  • reason (String)

    The reason for failure



124
125
126
127
128
129
# File 'lib/uniword/errors.rb', line 124

def initialize(from_format, to_format, reason)
  super("Cannot convert from #{from_format} to #{to_format}: #{reason}")
  @from_format = from_format
  @to_format = to_format
  @reason = reason
end

Instance Attribute Details

#from_formatSymbol (readonly)

Returns The source format.

Returns:

  • (Symbol)

    The source format



132
133
134
# File 'lib/uniword/errors.rb', line 132

def from_format
  @from_format
end

#reasonString (readonly)

Returns The reason.

Returns:

  • (String)

    The reason



138
139
140
# File 'lib/uniword/errors.rb', line 138

def reason
  @reason
end

#to_formatSymbol (readonly)

Returns The target format.

Returns:

  • (Symbol)

    The target format



135
136
137
# File 'lib/uniword/errors.rb', line 135

def to_format
  @to_format
end