Exception: Strict::Base::TypeError
- Inherits:
-
Exception
- Object
- Exception
- Strict::Base::TypeError
- Defined in:
- lib/base.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(error_list) ⇒ TypeError
constructor
A new instance of TypeError.
- #inspect ⇒ Object
Constructor Details
#initialize(error_list) ⇒ TypeError
Returns a new instance of TypeError.
6 7 8 9 10 11 |
# File 'lib/base.rb', line 6 def initialize(error_list) enforce_primitive!(Array, error_list, "lib/typestrict") error_list.each {|item| enforce_primitive!(String, item, "lib/typestrict")} @errors = error_list & error_list end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/base.rb', line 5 def errors @errors end |
Instance Method Details
#inspect ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/base.rb', line 13 def inspect msg = "TypeError#{@errors.size > 1 ? "s" : ""} caught:\n" @errors.each do |e| msg += "#{e}\n" end return msg end |