Updated #decode to use define_method instead of class_eval.