Skip to content

Instantly share code, notes, and snippets.

@bluerabbit
Created December 5, 2012 04:01
Show Gist options
  • Select an option

  • Save bluerabbit/4212095 to your computer and use it in GitHub Desktop.

Select an option

Save bluerabbit/4212095 to your computer and use it in GitHub Desktop.
String.true?欲しい
class String
def true?
self == 'true' || self == '1'
end
def false?
self == 'false' || self == '0'
end
end
[35] pry(main)> 'true'.true?
=> true
[33] pry(main)> 'false'.false?
=> true
[34] pry(main)> 'true'.false?
=> false
[36] pry(main)> '1'.true?
=> true
[37] pry(main)> '0'.true?
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment