I'm trying to use the XmlSimple gem in a script. My script looks like this:
gem 'xml-simple', '1.1.5'
xml = XmlSimple.xml_in('test_data.xml')
./script.rb:5:in `<main>': uninitialized constant XmlSimple (NameError)
You have activated the gem, by using the
gem method, but you haven’t required it. This means the gem’s files are now on your load path, but they haven’t been loaded by the Ruby interpreter, so their contents aren’t available to your program.
You simply need to add
You don’t always need the
gem method, you can just use
require and the latest installed version of the gem will automatically be activated — but if you want to specify which version to use you need to use