Created
May 25, 2011 04:39
-
-
Save ryanbriones/990345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def deadline_string=(deadline_string) | |
self.deadline = (parse_string(deadline_string, Chronic) || parse_string(deadline_string, Time)) | |
@deadline_invalid = true unless self.deadline | |
end | |
private | |
def parse_string(string, parser) | |
begin | |
parser.parse(string) | |
rescue | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's good, but what about setting an error?