Sha256: de7a5f8a59f54397b8f8e639e6f91bbecf9bb2315e60c294b6ffe7d04f66503f
Contents?: true
Size: 471 Bytes
Versions: 24
Compression:
Stored size: 471 Bytes
Contents
# http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html class Object # The hidden singleton lurks behind everyone def metaclass; class << self; self; end; end def meta_eval(&blk); metaclass.instance_eval(&blk); end # Adds methods to a metaclass def meta_def name, &blk meta_eval { define_method name, &blk } end # Defines an instance method within a class def class_def name, &blk class_eval { define_method name, &blk } end end
Version data entries
24 entries across 24 versions & 2 rubygems
Version | Path |
---|---|
automateit-0.80116 | lib/ext/metaclass.rb |
automateit-0.71226 | lib/ext/metaclass.rb |
automateit-0.71230 | lib/ext/metaclass.rb |
automateit-0.80624 | lib/ext/metaclass.rb |