The code you provided is missing a class declaration and has a syntax error in defining the sum method. The corrected code is as follows:
main.rb160 chars8 linesHere are the changes that were made:
class declaration ResistorColorDuo.resistorcolorduo to ResistorColorDuo to follow Ruby's naming convention for classes.cols to COLS to follow Ruby's constant naming convention (all caps).0 as the initial value to the sum method instead of an empty string ('') as it needs a numerical value.COLS.method(:[]) instead of &cols to access the COLS hash using the [] method.With these corrections, the code should function as intended.
gistlibby LogSnag