Created
September 9, 2015 10:50
-
-
Save kml/27af4a6db7fc3b1495fd 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 ClosedStruct < OpenStruct | |
# https://github.com/ruby/ruby/blob/trunk/lib/ostruct.rb#L176 | |
def method_missing(mid, *args) | |
return super if @table.has_key?(mid.to_sym) | |
raise NoMethodError, "undefined method `#{mid}' for #{self}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment