Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

You could use #inspect instead of quoting/parsing symbols #1

Closed
josqu4red opened this issue Jul 23, 2014 · 3 comments
Closed

You could use #inspect instead of quoting/parsing symbols #1

josqu4red opened this issue Jul 23, 2014 · 3 comments
Assignees

Comments

@josqu4red
Copy link

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
@harlanbarnes
Copy link
Contributor

Hey, this is great! I'll make this change in the next version. I'm going to re-open this issue to remind me.

@harlanbarnes harlanbarnes reopened this Jul 25, 2014
@josqu4red
Copy link
Author

It was just a suggestion, glad you like it!

@harlanbarnes
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants