meta_tools 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ meta_tools (0.2.6)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.3)
10
+ rspec (2.6.0)
11
+ rspec-core (~> 2.6.0)
12
+ rspec-expectations (~> 2.6.0)
13
+ rspec-mocks (~> 2.6.0)
14
+ rspec-core (2.6.4)
15
+ rspec-expectations (2.6.0)
16
+ diff-lcs (~> 1.1.2)
17
+ rspec-mocks (2.6.0)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ meta_tools!
24
+ rspec (~> 2.6.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
data/lib/meta_tools.rb CHANGED
@@ -13,22 +13,32 @@ module MetaTools
13
13
  def meta_eval(&blk)
14
14
  meta_class.instance_eval(&blk)
15
15
  end
16
-
16
+
17
+ # Evaluate a block within the instance of the meta_class
18
+ def meta_exec(*args, &blk)
19
+ meta_class.instance_exec(*args, &blk)
20
+ end
21
+
22
+ # Send a method to the meta_class
23
+ def meta_send(meth, *args, &blk)
24
+ meta_class.send(meth, *args, &blk)
25
+ end
26
+
17
27
  # Adds methods to a meta_class
18
28
  def meta_def(name, &blk)
19
29
  meta_eval { define_method(name, &blk) }
20
30
  end
21
-
31
+
32
+ # Returns an Array of methods defined only within this Object.
33
+ def meta_methods
34
+ self.class.instance_methods - Object.instance_methods
35
+ end
36
+
22
37
  # Defines an instance method within a class
23
38
  def class_def(name, &blk)
24
39
  class_eval { define_method(name, &blk) }
25
40
  end
26
41
 
27
- # Send a method to the meta_class
28
- def meta_send(meth, *args, &blk)
29
- meta_class.send(meth, *args, &blk)
30
- end
31
-
32
42
  # Send a method to the class
33
43
  def class_send(meth, *args, &blk)
34
44
  self.class.send(meth, *args, &blk)
@@ -0,0 +1,11 @@
1
+ require 'pathname'
2
+
3
+ class String
4
+ def to_pathname
5
+ Pathname.new(self)
6
+ end
7
+ end
8
+
9
+ __FILE__.to_pathname.dirname.glob("..", "lib", "**", "*.rb").each do |f|
10
+ require f.expand_path.to_s
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-05 00:00:00.000000000Z
13
- dependencies: []
12
+ date: 2011-09-12 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70276314773540 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.6.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70276314773540
14
25
  description: A Module that simply contains some methods that help out when metaprogramming.
15
26
  email: c00lryguy@gmail.com
16
27
  executables: []
@@ -22,8 +33,9 @@ files:
22
33
  - LICENSE
23
34
  - VERSION
24
35
  - Rakefile
25
- - meta_tools.gemspec
36
+ - Gemfile.lock
26
37
  - lib/meta_tools.rb
38
+ - spec/spec_helper.rb
27
39
  homepage: http://github.com/c00lryguy/meta_tools
28
40
  licenses: []
29
41
  post_install_message:
@@ -48,4 +60,5 @@ rubygems_version: 1.8.6
48
60
  signing_key:
49
61
  specification_version: 3
50
62
  summary: Tools for metaprogramming.
51
- test_files: []
63
+ test_files:
64
+ - spec/spec_helper.rb
data/meta_tools.gemspec DELETED
@@ -1,28 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.author = "Ryan Scott Lewis"
3
- s.email = "c00lryguy@gmail.com"
4
- s.homepage = "http://github.com/c00lryguy/meta_tools"
5
-
6
- s.description = "A Module that simply contains some methods that help out when metaprogramming."
7
- s.summary = "Tools for metaprogramming."
8
-
9
- s.require_paths = ["lib"]
10
-
11
- s.name = File.basename(__FILE__, ".gemspec")
12
- s.version = File.read("VERSION")
13
-
14
- # Add directories you *might* use in ALL projects.
15
- s.files = [File.basename(__FILE__)] + Dir['lib/**/*'] + Dir['spec/**/*']
16
-
17
- # Add files you *might* use in ALL projects!
18
- %W{Gemfile.lock README.* README Rakefile VERSION LICENSE}.each do |file|
19
- s.files.unshift(file) if File.exists?(file)
20
- end
21
-
22
- # Add files you *might* use in ALL projects!
23
- %W{README.* README VERSION LICENSE LICENSE.*}.each do |file|
24
- (s.extra_rdoc_files ||= []).unshift(file) if File.exists?(file)
25
- end
26
-
27
- s.test_files = Dir['spec/**/*_spec.rb']
28
- end