indifferent_eval 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/indifferent_eval/module.rb +16 -0
- data/lib/indifferent_eval.rb +1 -20
- metadata +25 -13
- data/bin/testing-bin +0 -3
@@ -0,0 +1,16 @@
|
|
1
|
+
module IndifferentEval
|
2
|
+
|
3
|
+
def indifferent_eval object_to_eval_on = self, &block
|
4
|
+
|
5
|
+
if block.arity == -1
|
6
|
+
# no block variable, use instance_eval
|
7
|
+
object_to_eval_on.instance_eval &block
|
8
|
+
|
9
|
+
else
|
10
|
+
# we were passed a variable, so #call the block
|
11
|
+
block.call object_to_eval_on
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/lib/indifferent_eval.rb
CHANGED
@@ -1,22 +1,3 @@
|
|
1
|
-
|
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
|
1
|
+
require File.dirname(__FILE__) + '/indifferent_eval/module'
|
21
2
|
|
22
3
|
Object.send :include, IndifferentEval
|
metadata
CHANGED
@@ -1,31 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indifferent_eval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
|
12
|
+
authors:
|
13
|
+
- remi
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-02-04 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
16
|
-
description:
|
17
|
-
email:
|
18
|
-
executables:
|
19
|
-
|
22
|
+
description: Can't decide between instance_eval and block.call? Why not support both!?
|
23
|
+
email: remi@remitaylor.com
|
24
|
+
executables: []
|
25
|
+
|
20
26
|
extensions: []
|
21
27
|
|
22
28
|
extra_rdoc_files: []
|
23
29
|
|
24
30
|
files:
|
25
31
|
- lib/indifferent_eval.rb
|
26
|
-
-
|
32
|
+
- lib/indifferent_eval/module.rb
|
27
33
|
has_rdoc: true
|
28
|
-
homepage:
|
34
|
+
homepage: http://github.com/remi/indifferent_eval
|
29
35
|
licenses: []
|
30
36
|
|
31
37
|
post_install_message:
|
@@ -34,21 +40,27 @@ rdoc_options: []
|
|
34
40
|
require_paths:
|
35
41
|
- lib
|
36
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
37
44
|
requirements:
|
38
45
|
- - ">="
|
39
46
|
- !ruby/object:Gem::Version
|
47
|
+
hash: 3
|
48
|
+
segments:
|
49
|
+
- 0
|
40
50
|
version: "0"
|
41
|
-
version:
|
42
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
43
53
|
requirements:
|
44
54
|
- - ">="
|
45
55
|
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
46
59
|
version: "0"
|
47
|
-
version:
|
48
60
|
requirements: []
|
49
61
|
|
50
62
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.3.
|
63
|
+
rubygems_version: 1.3.7
|
52
64
|
signing_key:
|
53
65
|
specification_version: 3
|
54
66
|
summary: Can't decide between instance_eval and block.call? Why not support both!?
|
data/bin/testing-bin
DELETED