Exception: Strict::Base::TypeError

Inherits:
Exception
  • Object
show all
Defined in:
lib/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_list) ⇒ TypeError

Returns a new instance of TypeError.



6
7
8
9
10
# 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
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/base.rb', line 5

def errors
  @errors
end

Instance Method Details

#inspectObject



12
13
14
15
16
17
18
# File 'lib/base.rb', line 12

def inspect
  msg = "TypeError#{@errors.size > 1 ? "s" : ""} caught:\n"
  @errors.each do |e|
    msg += "#{e}\n"
  end
  return msg
end