Jack Kelly Jack Kelly - 5 months ago 88
Ruby Question

What does 'no implicit conversion of Regexp into String (TypeError)' mean?

class String
def digit?

Test.assert_equals "".digit?, false
Test.assert_equals "7".digit?, true
Test.assert_equals " ".digit?, false

I have been playing around with regular expressions. Can you tell me how I have made an error? I have tried explicitly converting it to a string but it doesn't work nor do I see why I should have to. Could anyone enlighten me? Thank you!


include? expects a string as documented here. It seems like you were looking for match.