Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "undefined method `start_with?'"?

Tags:

ruby

I get:

undefined method 'start_with?' for "-f":String (NoMethodError)

At this line:

if arg.start_with?("-v")

This worked on a different machine apparently so I'm assuming it could be a problem with my Ruby installation. Any ideas?

like image 514
Michael Avatar asked Feb 17 '23 06:02

Michael


1 Answers

String#start_with? was introduced in Ruby 1.8.7. You're apparently using an earlier version, which is (sadly) not uncommon, but the 1.8 series is being retired shortly and you should considering upgrading.

I can't find any reference to String#start_with? in the 1.8.6 docs, but it exists in the 1.8.7 docs.

like image 124
meagar Avatar answered Feb 28 '23 11:02

meagar