Exception: Uniword::ConversionError
- Defined in:
- lib/uniword/errors.rb
Overview
Raised when a conversion between formats fails
Instance Attribute Summary collapse
-
#from_format ⇒ Symbol
readonly
The source format.
-
#reason ⇒ String
readonly
The reason.
-
#to_format ⇒ Symbol
readonly
The target format.
Instance Method Summary collapse
-
#initialize(from_format, to_format, reason) ⇒ ConversionError
constructor
A new instance of ConversionError.
Constructor Details
#initialize(from_format, to_format, reason) ⇒ ConversionError
Returns a new instance of ConversionError.
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_format ⇒ Symbol (readonly)
Returns The source format.
132 133 134 |
# File 'lib/uniword/errors.rb', line 132 def from_format @from_format end |
#reason ⇒ String (readonly)
Returns The reason.
138 139 140 |
# File 'lib/uniword/errors.rb', line 138 def reason @reason end |
#to_format ⇒ Symbol (readonly)
Returns The target format.
135 136 137 |
# File 'lib/uniword/errors.rb', line 135 def to_format @to_format end |