Skip to content

Instantly share code, notes, and snippets.

@Nowaker
Forked from banister/gist:1b0b43308373d06d79b9
Created March 1, 2012 03:07
Show Gist options
  • Save Nowaker/8fca6f2f4ff5127083f4 to your computer and use it in GitHub Desktop.
Save Nowaker/8fca6f2f4ff5127083f4 to your computer and use it in GitHub Desktop.
class and instance fail
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