/gist:8fca6f2f4ff5127083f4 Secret
Created
March 1, 2012 03:07
-
-
Save Nowaker/8fca6f2f4ff5127083f4 to your computer and use it in GitHub Desktop.
class and instance fail
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 Hello | |
@properties = {} | |
def self.attr_accessor name, type, default_value | |
super name | |
@properties[name] = type | |
send name.to_s + '=', default_value | |
end | |
attr_accessor :allow_nether, :boolean, true | |
end | |
# test would pass if 'send name.to_s + '=', default_value' was commented out | |
test 'define meta model' do | |
@props.allow_nether = false | |
assert_equal false, @props.allow_nether | |
end | |
# but you get | |
# NoMethodError: undefined method `allow_nether=' for MinecraftServerProperties:Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment