serializable_proc 0.3.1 → 0.4.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.
- data/HISTORY.txt +5 -1
- data/README.rdoc +6 -123
- data/Rakefile +4 -28
- data/VERSION +1 -1
- data/lib/serializable_proc/binding.rb +11 -15
- data/lib/serializable_proc/isolatable.rb +59 -42
- data/lib/serializable_proc.rb +15 -18
- data/serializable_proc.gemspec +12 -53
- data/spec/bounded_vars/errors_spec.rb +12 -4
- data/spec/bounded_vars/local_vars_within_block_scope_spec.rb +7 -7
- data/spec/code_block/magic_vars_spec.rb +1 -1
- data/spec/proc_like/invoking_with_args_spec.rb +6 -2
- data/spec/proc_like/others_spec.rb +15 -7
- data/spec/spec_helper.rb +6 -16
- metadata +47 -45
- data/lib/serializable_proc/parsers/dynamic.rb +0 -13
- data/lib/serializable_proc/parsers/static.rb +0 -103
- data/lib/serializable_proc/parsers.rb +0 -30
- data/spec/code_block/errors_spec.rb +0 -65
- data/spec/code_block/multiple_arities_spec.rb +0 -159
- data/spec/code_block/optional_arity_spec.rb +0 -160
- data/spec/code_block/single_arity_spec.rb +0 -159
- data/spec/code_block/zero_arity_spec.rb +0 -159
- data/spec/extending/new_matcher_w_multiple_arities_spec.rb +0 -152
- data/spec/extending/new_matcher_w_optional_arity_spec.rb +0 -152
- data/spec/extending/new_matcher_w_single_arity_spec.rb +0 -152
- data/spec/extending/new_matcher_w_zero_arity_spec.rb +0 -152
- data/spec/extending/spec_helper.rb +0 -23
- data/spec/extending/subclassing_w_multiple_arities_spec.rb +0 -74
- data/spec/extending/subclassing_w_optional_arity_spec.rb +0 -74
- data/spec/extending/subclassing_w_single_arity_spec.rb +0 -74
- data/spec/extending/subclassing_w_zero_arity_spec.rb +0 -74
@@ -1,74 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
|
3
|
-
describe 'Subclassing w single arity' do
|
4
|
-
|
5
|
-
extend SerializableProc::Spec::Helpers
|
6
|
-
expected_file = File.expand_path(__FILE__)
|
7
|
-
expected_code = "lambda { |lvar_arg| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
|
8
|
-
|
9
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
10
|
-
(
|
11
|
-
Otaky::MagicProc.new do |arg|
|
12
|
-
%w{a b}.map{|x| puts x }
|
13
|
-
end
|
14
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
15
|
-
end
|
16
|
-
|
17
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
18
|
-
(Otaky::MagicProc.new do |arg| %w{a b}.map{|x| puts x } end).
|
19
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
23
|
-
(
|
24
|
-
Otaky::MagicProc.new { |arg|
|
25
|
-
%w{a b}.map{|x| puts x }
|
26
|
-
}
|
27
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
28
|
-
end
|
29
|
-
|
30
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
31
|
-
(Otaky::MagicProc.new { |arg| %w{a b}.map{|x| puts x } }).
|
32
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
33
|
-
end
|
34
|
-
|
35
|
-
should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
|
36
|
-
(Otaky::MagicProc.new(&(lambda { |arg| %w{a b}.map{|x| puts x } }))).
|
37
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
38
|
-
end
|
39
|
-
|
40
|
-
should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
|
41
|
-
(
|
42
|
-
Otaky::MagicProc.new(&(lambda do |arg|
|
43
|
-
%w{a b}.map{|x| puts x }
|
44
|
-
end))
|
45
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
46
|
-
end
|
47
|
-
|
48
|
-
should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
|
49
|
-
(Otaky::MagicProc.new(&(proc { |arg| %w{a b}.map{|x| puts x } }))).
|
50
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
51
|
-
end
|
52
|
-
|
53
|
-
should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
|
54
|
-
(
|
55
|
-
Otaky::MagicProc.new(&(proc do |arg|
|
56
|
-
%w{a b}.map{|x| puts x }
|
57
|
-
end))
|
58
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
59
|
-
end
|
60
|
-
|
61
|
-
should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
|
62
|
-
(Otaky::MagicProc.new(&(Proc.new { |arg| %w{a b}.map{|x| puts x } }))).
|
63
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
64
|
-
end
|
65
|
-
|
66
|
-
should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
|
67
|
-
(
|
68
|
-
Otaky::MagicProc.new(&(Proc.new do |arg|
|
69
|
-
%w{a b}.map{|x| puts x }
|
70
|
-
end))
|
71
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
|
3
|
-
describe 'Subclassing w zero arity' do
|
4
|
-
|
5
|
-
extend SerializableProc::Spec::Helpers
|
6
|
-
expected_file = File.expand_path(__FILE__)
|
7
|
-
expected_code = "lambda { [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
|
8
|
-
|
9
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
10
|
-
(
|
11
|
-
Otaky::MagicProc.new do
|
12
|
-
%w{a b}.map{|x| puts x }
|
13
|
-
end
|
14
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
15
|
-
end
|
16
|
-
|
17
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
18
|
-
(Otaky::MagicProc.new do %w{a b}.map{|x| puts x } end).
|
19
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
23
|
-
(
|
24
|
-
Otaky::MagicProc.new {
|
25
|
-
%w{a b}.map{|x| puts x }
|
26
|
-
}
|
27
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
28
|
-
end
|
29
|
-
|
30
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
31
|
-
(Otaky::MagicProc.new { %w{a b}.map{|x| puts x } }).
|
32
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
33
|
-
end
|
34
|
-
|
35
|
-
should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
|
36
|
-
(Otaky::MagicProc.new(&(lambda { %w{a b}.map{|x| puts x } }))).
|
37
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
38
|
-
end
|
39
|
-
|
40
|
-
should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
|
41
|
-
(
|
42
|
-
Otaky::MagicProc.new(&(lambda do
|
43
|
-
%w{a b}.map{|x| puts x }
|
44
|
-
end))
|
45
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
46
|
-
end
|
47
|
-
|
48
|
-
should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
|
49
|
-
(Otaky::MagicProc.new(&(proc { %w{a b}.map{|x| puts x } }))).
|
50
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
51
|
-
end
|
52
|
-
|
53
|
-
should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
|
54
|
-
(
|
55
|
-
Otaky::MagicProc.new(&(proc do
|
56
|
-
%w{a b}.map{|x| puts x }
|
57
|
-
end))
|
58
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
59
|
-
end
|
60
|
-
|
61
|
-
should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
|
62
|
-
(Otaky::MagicProc.new(&(Proc.new { %w{a b}.map{|x| puts x } }))).
|
63
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
64
|
-
end
|
65
|
-
|
66
|
-
should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
|
67
|
-
(
|
68
|
-
Otaky::MagicProc.new(&(Proc.new do
|
69
|
-
%w{a b}.map{|x| puts x }
|
70
|
-
end))
|
71
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|