You could use #inspect instead of quoting/parsing symbols
josqu4red opened this issue · comments
Object#inspect produces valid ruby code with most of basic types (Int, String, Symbol, Array, ...). Works find in my (not public :() Lita cookbook.
>> puts 42.inspect
42
=> nil
>> puts "bar".inspect
"bar"
=> nil
>> puts :foo.inspect
:foo
=> nil
>> puts [:a, :b, :c].inspect
[:a, :b, :c]
=> nil
Hey, this is great! I'll make this change in the next version. I'm going to re-open this issue to remind me.
It was just a suggestion, glad you like it!
This worked really well for places where you can set attributes via ruby ... for example, wrapper cookbooks or the ruby versions of roles and environments. But any places that you used JSON (i.e. JSON versions of roles and environments and/or knife bootstrap with JSON attributes) you would always, of course, get strings. I went back and forth on what to do with this but because we use the JSON versions of things over the ruby versions, of things, I just left my crazy hack/parsing in there.
It feels crappy, but it's effective.
It was a great suggestion though.