metaid 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/metaid.rb +17 -0
  2. metadata +39 -0
@@ -0,0 +1,17 @@
1
+ # Metaid == a few simple metaclass helper
2
+ # (See http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html.)
3
+ class Object
4
+ # The hidden singleton lurks behind everyone
5
+ def metaclass; class << self; self; end; end
6
+ def meta_eval &blk; metaclass.instance_eval &blk; end
7
+
8
+ # Adds methods to a metaclass
9
+ def meta_def name, &blk
10
+ meta_eval { define_method name, &blk }
11
+ end
12
+
13
+ # Defines an instance method within a class
14
+ def class_def name, &blk
15
+ class_eval { define_method name, &blk }
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,39 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: metaid
5
+ version: !ruby/object:Gem::Version
6
+ version: "1.0"
7
+ date: 2006-01-17 00:00:00 -07:00
8
+ summary: slight metaprogramming helpers
9
+ require_paths:
10
+ - "."
11
+ email: why@ruby-lang.org
12
+ homepage: http://whytheluckystiff.net/metaid/
13
+ rubyforge_project: hobix
14
+ description:
15
+ autorequire: metaid
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ signing_key:
28
+ cert_chain:
29
+ authors:
30
+ - why the lucky stiff
31
+ files:
32
+ - metaid.rb
33
+ test_files: []
34
+ rdoc_options: []
35
+ extra_rdoc_files: []
36
+ executables: []
37
+ extensions: []
38
+ requirements: []
39
+ dependencies: []