serializable_proc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.txt +6 -2
- data/README.rdoc +8 -1
- data/VERSION +1 -1
- data/lib/serializable_proc.rb +1 -0
- data/lib/serializable_proc/binding.rb +4 -3
- data/lib/serializable_proc/fixes.rb +9 -0
- data/serializable_proc.gemspec +97 -0
- metadata +6 -4
data/HISTORY.txt
CHANGED
data/README.rdoc
CHANGED
@@ -102,6 +102,12 @@ But the following will work as expected:
|
|
102
102
|
x_proc = lambda { x }
|
103
103
|
create_serializable_proc(&x_proc)
|
104
104
|
|
105
|
+
== Supported Rubies
|
106
|
+
|
107
|
+
SerializableProc has been tested to work on the following rubies:
|
108
|
+
|
109
|
+
1. MRI 1.8.6, 1.8.7 & 1.9.1
|
110
|
+
|
105
111
|
== TODO (just brain-dumping)
|
106
112
|
|
107
113
|
1. Provide flexibility for user to specify whether global variables should be isolated,
|
@@ -114,7 +120,8 @@ But the following will work as expected:
|
|
114
120
|
of ParseTree or RubyParser
|
115
121
|
4. Implement workaround to tackle line-numbering bug in JRuby, which causes the
|
116
122
|
RubyParser-based implementation to fail, for more info abt JRuby's line-numbering
|
117
|
-
bug, see http://stackoverflow.com/questions/3454838/jruby-line-numbering-problem
|
123
|
+
bug, see http://stackoverflow.com/questions/3454838/jruby-line-numbering-problem &
|
124
|
+
http://jira.codehaus.org/browse/JRUBY-5014
|
118
125
|
|
119
126
|
== Note on Patches/Pull Requests
|
120
127
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/serializable_proc.rb
CHANGED
@@ -13,7 +13,7 @@ class SerializableProc
|
|
13
13
|
ignore, var = m[1..2]
|
14
14
|
sexp_str.sub!(ignore,'')
|
15
15
|
begin
|
16
|
-
val =
|
16
|
+
val = eval(var, binding) rescue nil
|
17
17
|
@vars.update(Sandboxer.fvar(var) => mclone(val))
|
18
18
|
rescue TypeError
|
19
19
|
raise CannotSerializeVariableError.new("Variable #{var} cannot be serialized !!")
|
@@ -24,8 +24,9 @@ class SerializableProc
|
|
24
24
|
def eval!
|
25
25
|
@binding ||= (
|
26
26
|
set_vars = @vars.map{|(k,v)| "#{k} = Marshal.load(%|#{mdump(v)}|)" } * '; '
|
27
|
-
(binding = Kernel.binding)
|
28
|
-
binding
|
27
|
+
eval(set_vars, binding = Kernel.binding)
|
28
|
+
binding
|
29
|
+
# binding.extend(Extensions)
|
29
30
|
)
|
30
31
|
end
|
31
32
|
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{serializable_proc}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["NgTzeYang"]
|
12
|
+
s.date = %q{2010-08-16}
|
13
|
+
s.description = %q{
|
14
|
+
Give & take, serializing a ruby proc is possible, though not a perfect one.
|
15
|
+
Requires either ParseTree (faster) or RubyParser (& Ruby2Ruby).
|
16
|
+
}
|
17
|
+
s.email = %q{ngty77@gmail.com}
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".gitignore",
|
25
|
+
"HISTORY.txt",
|
26
|
+
"LICENSE",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"lib/serializable_proc.rb",
|
31
|
+
"lib/serializable_proc/binding.rb",
|
32
|
+
"lib/serializable_proc/fixes.rb",
|
33
|
+
"lib/serializable_proc/marshalable.rb",
|
34
|
+
"lib/serializable_proc/parsers.rb",
|
35
|
+
"lib/serializable_proc/parsers/pt.rb",
|
36
|
+
"lib/serializable_proc/parsers/rp.rb",
|
37
|
+
"lib/serializable_proc/sandboxer.rb",
|
38
|
+
"serializable_proc.gemspec",
|
39
|
+
"spec/extracting_bound_variables_spec.rb",
|
40
|
+
"spec/initializing_errors_spec.rb",
|
41
|
+
"spec/marshalling_spec.rb",
|
42
|
+
"spec/multiple_arities_serializable_proc_spec.rb",
|
43
|
+
"spec/one_arity_serializable_proc_spec.rb",
|
44
|
+
"spec/optional_arity_serializable_proc_spec.rb",
|
45
|
+
"spec/proc_like_spec.rb",
|
46
|
+
"spec/spec_helper.rb",
|
47
|
+
"spec/zero_arity_serializable_proc_spec.rb"
|
48
|
+
]
|
49
|
+
s.homepage = %q{http://github.com/ngty/serializable_proc}
|
50
|
+
s.post_install_message = %q{
|
51
|
+
/////////////////////////////////////////////////////////////////////////////////
|
52
|
+
|
53
|
+
** SerializableProc **
|
54
|
+
|
55
|
+
You are installing SerializableProc on a ruby platform & version that supports
|
56
|
+
ParseTree. With ParseTree, u can enjoy better performance of SerializableProc,
|
57
|
+
as well as other dynamic code analysis goodness, as compared to the default
|
58
|
+
implementation using RubyParser's less flexible static code analysis.
|
59
|
+
|
60
|
+
Anyway, u have been informed, SerializableProc will fallback on its default
|
61
|
+
implementation using RubyParser.
|
62
|
+
|
63
|
+
/////////////////////////////////////////////////////////////////////////////////
|
64
|
+
}
|
65
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
66
|
+
s.require_paths = ["lib"]
|
67
|
+
s.rubygems_version = %q{1.3.7}
|
68
|
+
s.summary = %q{Proc that can be serialized (as the name suggests)}
|
69
|
+
s.test_files = [
|
70
|
+
"spec/initializing_errors_spec.rb",
|
71
|
+
"spec/extracting_bound_variables_spec.rb",
|
72
|
+
"spec/one_arity_serializable_proc_spec.rb",
|
73
|
+
"spec/zero_arity_serializable_proc_spec.rb",
|
74
|
+
"spec/multiple_arities_serializable_proc_spec.rb",
|
75
|
+
"spec/marshalling_spec.rb",
|
76
|
+
"spec/optional_arity_serializable_proc_spec.rb",
|
77
|
+
"spec/spec_helper.rb",
|
78
|
+
"spec/proc_like_spec.rb"
|
79
|
+
]
|
80
|
+
|
81
|
+
if s.respond_to? :specification_version then
|
82
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
83
|
+
s.specification_version = 3
|
84
|
+
|
85
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
86
|
+
s.add_runtime_dependency(%q<ruby2ruby>, [">= 1.2.4"])
|
87
|
+
s.add_development_dependency(%q<bacon>, [">= 0"])
|
88
|
+
else
|
89
|
+
s.add_dependency(%q<ruby2ruby>, [">= 1.2.4"])
|
90
|
+
s.add_dependency(%q<bacon>, [">= 0"])
|
91
|
+
end
|
92
|
+
else
|
93
|
+
s.add_dependency(%q<ruby2ruby>, [">= 1.2.4"])
|
94
|
+
s.add_dependency(%q<bacon>, [">= 0"])
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serializable_proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- NgTzeYang
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-16 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -67,11 +67,13 @@ files:
|
|
67
67
|
- VERSION
|
68
68
|
- lib/serializable_proc.rb
|
69
69
|
- lib/serializable_proc/binding.rb
|
70
|
+
- lib/serializable_proc/fixes.rb
|
70
71
|
- lib/serializable_proc/marshalable.rb
|
71
72
|
- lib/serializable_proc/parsers.rb
|
72
73
|
- lib/serializable_proc/parsers/pt.rb
|
73
74
|
- lib/serializable_proc/parsers/rp.rb
|
74
75
|
- lib/serializable_proc/sandboxer.rb
|
76
|
+
- serializable_proc.gemspec
|
75
77
|
- spec/extracting_bound_variables_spec.rb
|
76
78
|
- spec/initializing_errors_spec.rb
|
77
79
|
- spec/marshalling_spec.rb
|