Created
August 27, 2013 07:36
-
-
Save strika/6350713 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 NullObject | |
def nil?; true; end | |
def !; true end | |
def to_a; []; end | |
def to_s(*args); ""; end | |
def to_str(*args); ""; end | |
def to_f(*args); 0.0; end | |
def to_i(*args); 0; end | |
def method_missing(*args, &blk) | |
self | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment