I know this is in the builder gem. So I put it in my Gemfile. Then I bundle install.
Running in the console, I type:
x = "akwf"
then:
x.to_xs
and am rewarded with:
NoMethodError: undefined method `to_xs' for "akwf":String
When I try require 'builder' and require 'builder/xchar' I am met with false.
What basic item am I missing in order for me to perform this basic function?
First, note that Rails includes
builderalready, so no need to add it to theGemfile.Second, a false return value when requiring isn’t really bad. It just means that the library has already been successfully required and didn’t need to be re-required. If
requireis having trouble loading a library, it’ll raise an exception, not return false.Third,
builder/xchar.rbspecifies that, ifString#encodeis defined, then it skips the oldString#to_xsdefinition and instead definesBuilder::XChar.encode(string), which seems to serve the same purpose. Try requiringbuilder/xcharand giving that a shot.