Sha256: 57dc1373ecef6ade7e0c05c96be579db92913c80aeb49f3d729e41bbc62939c3
Contents?: true
Size: 397 Bytes
Versions: 14
Compression:
Stored size: 397 Bytes
Contents
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
14 entries across 14 versions & 1 rubygems