Exception: Rus3::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Rus3::Error
- Includes:
- EmptyList
- Defined in:
- lib/rus3/error.rb
Direct Known Subclasses
CannotFindFileError, CharRequiredError, ExceedUpperLimitError, IntegerRequiredError, ListRequiredError, NotImplementedYetError, NumberRequiredError, OutOfRangeError, PairOrListRequiredError, PairRequiredError, RealNumberRequiredError, SchemeSyntaxError, StringRequiredError, UknownOperatorError, UnsupportedFeatureError, UnsupportedMethodError, VectorRequiredError, WrongTypeError
Constant Summary collapse
- A2L_MAP =
:nodoc:
{ "[" => "(", "," => "", "]" => ")"}
Constants included from EmptyList
Instance Method Summary collapse
-
#smart_error_value(obj) ⇒ Object
:nodoc:.
Methods included from EmptyList
Instance Method Details
#smart_error_value(obj) ⇒ Object
:nodoc:
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rus3/error.rb', line 7 def smart_error_value(obj) # :nodoc: case obj when Array if obj.empty? # an empty list "()" else # a normal proper list list_notation = obj.to_s().gsub(/[\[\],]/, A2L_MAP) "list( %s )" % list_notation end when Numeric "number(%d)" % obj when Rus3::Pair "pair(%s)" % obj when Rus3::Vector "vector(%s)" % obj else "%s(%s)" % [obj.class, obj] end end |