class Naseweis::ConversionError
A ConversionError
is raised when the given data can't be converted to the requested type. It acts as a common error to catch all other errors that are raised by Ruby when converting between types.
@attr_reader [String] data the data that was attempted to convert @attr_reader [String] type the typename that was requested
Attributes
data[R]
type[R]
Public Class Methods
new(data, type)
click to toggle source
Create a new ConversionError
@param data [String] value for {#data} @param type [String] value for {#type}
# File lib/naseweis/converter.rb, line 15 def initialize(data, type) @data = data @type = type end
Public Instance Methods
to_s()
click to toggle source
Get the string representation for the error
@return [String] error string
# File lib/naseweis/converter.rb, line 23 def to_s "Can't convert '#{@data}' to #{type}" end