indifferent_eval 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/testing-bin +3 -0
  2. data/lib/indifferent_eval.rb +22 -0
  3. metadata +56 -0
data/bin/testing-bin ADDED
@@ -0,0 +1,3 @@
1
+ #! /usr/bin/env ruby
2
+ puts "Hello from testing bin!"
3
+ puts "I am in directory: #{ File.dirname(__FILE__) }"
@@ -0,0 +1,22 @@
1
+ # file documentation
2
+
3
+ # module documentation
4
+ module IndifferentEval
5
+
6
+ # method documentation
7
+ def indifferent_eval object_to_eval_on = self, &block
8
+
9
+ if block.arity == -1
10
+ # no block variable, use instance_eval
11
+ object_to_eval_on.instance_eval &block
12
+
13
+ else
14
+ # we were passed a variable, so #call the block
15
+ block.call object_to_eval_on
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ Object.send :include, IndifferentEval
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: indifferent_eval
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors: []
7
+
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-15 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email:
18
+ executables:
19
+ - testing-bin
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/indifferent_eval.rb
26
+ - bin/testing-bin
27
+ has_rdoc: true
28
+ homepage:
29
+ licenses: []
30
+
31
+ post_install_message:
32
+ rdoc_options: []
33
+
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "0"
41
+ version:
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ requirements: []
49
+
50
+ rubyforge_project:
51
+ rubygems_version: 1.3.5
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: Can't decide between instance_eval and block.call? Why not support both!?
55
+ test_files: []
56
+