Skip to content

Instantly share code, notes, and snippets.

@philk
Created July 12, 2012 17:33
Show Gist options
  • Select an option

  • Save philk/3099524 to your computer and use it in GitHub Desktop.

Select an option

Save philk/3099524 to your computer and use it in GitHub Desktop.
Convert any Ruby object into a Python string (for ERB templates in Chef)
class Object
def to_py_bool
(!!self).to_s.capitalize
end
end
@jordane
Copy link
Copy Markdown

jordane commented Jul 12, 2012

So what you're saying is that after adding this, we can further obscure our attributes by assigning them differing non-boolean values, and yet they will all end up as the right thing. +1!

@philk
Copy link
Copy Markdown
Author

philk commented Jul 12, 2012

Fry

@jordane
Copy link
Copy Markdown

jordane commented Jul 12, 2012

zoidberg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment