Exception: TypeError
- Inherits:
-
Exception
- Object
- Exception
- TypeError
- Defined in:
- lib/dsl/monkeypatches.rb
Overview
Helper for parsing type errors in machine-readable format.
Instance Method Summary collapse
-
#type_data ⇒ Hash
Parses the error string and returns the machine-readable expected arguments classes.
Instance Method Details
#type_data ⇒ Hash
Parses the error string and returns the machine-readable expected arguments classes.
194 195 196 197 198 199 200 |
# File 'lib/dsl/monkeypatches.rb', line 194 def type_data # ⇒ can't convert Hash into Integer # There are two ways to match: either rely on us locale, or find the uppercased classes /[^[A-Z]]*(?<given>[A-Z]\w*)[^[A-Z]]*(?<required>[A-Z]\w*)/.match(self.to_s) { |m| { :given => m[:given], :required => m[:required] } } end |