Created
September 6, 2012 01:50
-
-
Save barelyknown/3649793 to your computer and use it in GitHub Desktop.
Approach to Getter/Setter for Hash Access
This file contains hidden or 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
def earliest_window_end | |
@earliest_window_end ||= {} | |
end | |
def method_missing(method, *args, &block) | |
if method =~ /^(.+?)_earliest_window_end(\=*)$/ | |
!$2.blank? ? earliest_window_end[$1] = args[0] : earliest_window_end[$1] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment