Skip to content

Instantly share code, notes, and snippets.

@nthj
Created April 5, 2011 00:53
Show Gist options
  • Save nthj/902807 to your computer and use it in GitHub Desktop.
Save nthj/902807 to your computer and use it in GitHub Desktop.
Ruby string extensions for easily defining questionable methods like "email?"
class String
def questionable
questionable? ? to_s : "#{to_s}?"
end
def questionable!
replace questionable
end
def questionable?
self[-1, 1] == '?'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment