serializable_proc 0.2.0 → 0.3.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.
@@ -0,0 +1,74 @@
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
@@ -0,0 +1,74 @@
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
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serializable_proc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
11
10
  platform: ruby
12
11
  authors:
13
- - NgTzeYang
12
+ - NgTzeYang
14
13
  autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
@@ -18,36 +17,32 @@ cert_chain: []
18
17
  date: 2010-08-18 00:00:00 +08:00
19
18
  default_executable:
20
19
  dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: ruby2ruby
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 23
30
- segments:
31
- - 1
32
- - 2
33
- - 4
34
- version: 1.2.4
35
- type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: bacon
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
49
- type: :development
50
- version_requirements: *id002
20
+ - !ruby/object:Gem::Dependency
21
+ name: ruby2ruby
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 4
31
+ version: 1.2.4
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bacon
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :development
45
+ version_requirements: *id002
51
46
  description: "\n Give & take, serializing a ruby proc is possible, though not a perfect one.\n Requires either ParseTree (faster) or RubyParser (& Ruby2Ruby).\n "
52
47
  email: ngty77@gmail.com
53
48
  executables: []
@@ -55,105 +50,121 @@ executables: []
55
50
  extensions: []
56
51
 
57
52
  extra_rdoc_files:
58
- - LICENSE
59
- - README.rdoc
53
+ - LICENSE
54
+ - README.rdoc
60
55
  files:
61
- - .document
62
- - .gitignore
63
- - HISTORY.txt
64
- - LICENSE
65
- - README.rdoc
66
- - Rakefile
67
- - VERSION
68
- - lib/serializable_proc.rb
69
- - lib/serializable_proc/binding.rb
70
- - lib/serializable_proc/fixes.rb
71
- - lib/serializable_proc/isolatable.rb
72
- - lib/serializable_proc/marshalable.rb
73
- - lib/serializable_proc/parsers.rb
74
- - lib/serializable_proc/parsers/pt.rb
75
- - lib/serializable_proc/parsers/rp.rb
76
- - serializable_proc.gemspec
77
- - spec/bounded_vars/class_vars_spec.rb
78
- - spec/bounded_vars/class_vars_within_block_scope_spec.rb
79
- - spec/bounded_vars/errors_spec.rb
80
- - spec/bounded_vars/global_vars_spec.rb
81
- - spec/bounded_vars/global_vars_within_block_scope_spec.rb
82
- - spec/bounded_vars/instance_vars_spec.rb
83
- - spec/bounded_vars/instance_vars_within_block_scope_spec.rb
84
- - spec/bounded_vars/local_vars_spec.rb
85
- - spec/bounded_vars/local_vars_within_block_scope_spec.rb
86
- - spec/code_block/errors_spec.rb
87
- - spec/code_block/multiple_arities_spec.rb
88
- - spec/code_block/optional_arity_spec.rb
89
- - spec/code_block/renaming_vars_spec.rb
90
- - spec/code_block/single_arity_spec.rb
91
- - spec/code_block/zero_arity_spec.rb
92
- - spec/proc_like/extras_spec.rb
93
- - spec/proc_like/invoking_with_args_spec.rb
94
- - spec/proc_like/invoking_with_class_vars_spec.rb
95
- - spec/proc_like/invoking_with_global_vars_spec.rb
96
- - spec/proc_like/invoking_with_instance_vars_spec.rb
97
- - spec/proc_like/invoking_with_local_vars_spec.rb
98
- - spec/proc_like/marshalling_spec.rb
99
- - spec/proc_like/others_spec.rb
100
- - spec/spec_helper.rb
56
+ - .document
57
+ - .gitignore
58
+ - HISTORY.txt
59
+ - LICENSE
60
+ - README.rdoc
61
+ - Rakefile
62
+ - VERSION
63
+ - lib/serializable_proc.rb
64
+ - lib/serializable_proc/binding.rb
65
+ - lib/serializable_proc/fixes.rb
66
+ - lib/serializable_proc/isolatable.rb
67
+ - lib/serializable_proc/marshalable.rb
68
+ - lib/serializable_proc/parsers.rb
69
+ - lib/serializable_proc/parsers/dynamic.rb
70
+ - lib/serializable_proc/parsers/static.rb
71
+ - serializable_proc.gemspec
72
+ - spec/bounded_vars/class_vars_spec.rb
73
+ - spec/bounded_vars/class_vars_within_block_scope_spec.rb
74
+ - spec/bounded_vars/errors_spec.rb
75
+ - spec/bounded_vars/global_vars_spec.rb
76
+ - spec/bounded_vars/global_vars_within_block_scope_spec.rb
77
+ - spec/bounded_vars/instance_vars_spec.rb
78
+ - spec/bounded_vars/instance_vars_within_block_scope_spec.rb
79
+ - spec/bounded_vars/local_vars_spec.rb
80
+ - spec/bounded_vars/local_vars_within_block_scope_spec.rb
81
+ - spec/code_block/errors_spec.rb
82
+ - spec/code_block/magic_vars_spec.rb
83
+ - spec/code_block/multiple_arities_spec.rb
84
+ - spec/code_block/optional_arity_spec.rb
85
+ - spec/code_block/renaming_vars_spec.rb
86
+ - spec/code_block/single_arity_spec.rb
87
+ - spec/code_block/zero_arity_spec.rb
88
+ - spec/extending/new_matcher_w_multiple_arities_spec.rb
89
+ - spec/extending/new_matcher_w_optional_arity_spec.rb
90
+ - spec/extending/new_matcher_w_single_arity_spec.rb
91
+ - spec/extending/new_matcher_w_zero_arity_spec.rb
92
+ - spec/extending/spec_helper.rb
93
+ - spec/extending/subclassing_w_multiple_arities_spec.rb
94
+ - spec/extending/subclassing_w_optional_arity_spec.rb
95
+ - spec/extending/subclassing_w_single_arity_spec.rb
96
+ - spec/extending/subclassing_w_zero_arity_spec.rb
97
+ - spec/proc_like/extras_spec.rb
98
+ - spec/proc_like/invoking_with_args_spec.rb
99
+ - spec/proc_like/invoking_with_class_vars_spec.rb
100
+ - spec/proc_like/invoking_with_global_vars_spec.rb
101
+ - spec/proc_like/invoking_with_instance_vars_spec.rb
102
+ - spec/proc_like/invoking_with_local_vars_spec.rb
103
+ - spec/proc_like/marshalling_spec.rb
104
+ - spec/proc_like/others_spec.rb
105
+ - spec/spec_helper.rb
101
106
  has_rdoc: true
102
107
  homepage: http://github.com/ngty/serializable_proc
103
108
  licenses: []
104
109
 
105
- post_install_message: "\n /////////////////////////////////////////////////////////////////////////////////\n\n ** SerializableProc **\n\n You are installing SerializableProc on a ruby platform & version that supports\n ParseTree. With ParseTree, u can enjoy better performance of SerializableProc,\n as well as other dynamic code analysis goodness, as compared to the default\n implementation using RubyParser's less flexible static code analysis.\n\n Anyway, u have been informed, SerializableProc will fallback on its default\n implementation using RubyParser.\n\n /////////////////////////////////////////////////////////////////////////////////\n "
110
+ post_install_message:
106
111
  rdoc_options:
107
- - --charset=UTF-8
112
+ - --charset=UTF-8
108
113
  require_paths:
109
- - lib
114
+ - lib
110
115
  required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
116
  requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ segments:
120
+ - 0
121
+ version: "0"
119
122
  required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
123
  requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- hash: 3
125
- segments:
126
- - 0
127
- version: "0"
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ segments:
127
+ - 0
128
+ version: "0"
128
129
  requirements: []
129
130
 
130
131
  rubyforge_project:
131
- rubygems_version: 1.3.7
132
+ rubygems_version: 1.3.6
132
133
  signing_key:
133
134
  specification_version: 3
134
135
  summary: Proc that can be serialized (as the name suggests)
135
136
  test_files:
136
- - spec/proc_like/extras_spec.rb
137
- - spec/proc_like/invoking_with_local_vars_spec.rb
138
- - spec/proc_like/invoking_with_instance_vars_spec.rb
139
- - spec/proc_like/invoking_with_class_vars_spec.rb
140
- - spec/proc_like/invoking_with_args_spec.rb
141
- - spec/proc_like/others_spec.rb
142
- - spec/proc_like/invoking_with_global_vars_spec.rb
143
- - spec/proc_like/marshalling_spec.rb
144
- - spec/code_block/multiple_arities_spec.rb
145
- - spec/code_block/zero_arity_spec.rb
146
- - spec/code_block/errors_spec.rb
147
- - spec/code_block/renaming_vars_spec.rb
148
- - spec/code_block/single_arity_spec.rb
149
- - spec/code_block/optional_arity_spec.rb
150
- - spec/bounded_vars/global_vars_within_block_scope_spec.rb
151
- - spec/bounded_vars/instance_vars_within_block_scope_spec.rb
152
- - spec/bounded_vars/errors_spec.rb
153
- - spec/bounded_vars/local_vars_within_block_scope_spec.rb
154
- - spec/bounded_vars/class_vars_spec.rb
155
- - spec/bounded_vars/local_vars_spec.rb
156
- - spec/bounded_vars/global_vars_spec.rb
157
- - spec/bounded_vars/instance_vars_spec.rb
158
- - spec/bounded_vars/class_vars_within_block_scope_spec.rb
159
- - spec/spec_helper.rb
137
+ - spec/spec_helper.rb
138
+ - spec/proc_like/extras_spec.rb
139
+ - spec/proc_like/invoking_with_local_vars_spec.rb
140
+ - spec/proc_like/invoking_with_instance_vars_spec.rb
141
+ - spec/proc_like/invoking_with_class_vars_spec.rb
142
+ - spec/proc_like/invoking_with_args_spec.rb
143
+ - spec/proc_like/others_spec.rb
144
+ - spec/proc_like/invoking_with_global_vars_spec.rb
145
+ - spec/proc_like/marshalling_spec.rb
146
+ - spec/code_block/magic_vars_spec.rb
147
+ - spec/code_block/multiple_arities_spec.rb
148
+ - spec/code_block/zero_arity_spec.rb
149
+ - spec/code_block/errors_spec.rb
150
+ - spec/code_block/renaming_vars_spec.rb
151
+ - spec/code_block/single_arity_spec.rb
152
+ - spec/code_block/optional_arity_spec.rb
153
+ - spec/extending/subclassing_w_optional_arity_spec.rb
154
+ - spec/extending/subclassing_w_single_arity_spec.rb
155
+ - spec/extending/new_matcher_w_multiple_arities_spec.rb
156
+ - spec/extending/subclassing_w_zero_arity_spec.rb
157
+ - spec/extending/new_matcher_w_single_arity_spec.rb
158
+ - spec/extending/subclassing_w_multiple_arities_spec.rb
159
+ - spec/extending/new_matcher_w_optional_arity_spec.rb
160
+ - spec/extending/new_matcher_w_zero_arity_spec.rb
161
+ - spec/extending/spec_helper.rb
162
+ - spec/bounded_vars/global_vars_within_block_scope_spec.rb
163
+ - spec/bounded_vars/instance_vars_within_block_scope_spec.rb
164
+ - spec/bounded_vars/errors_spec.rb
165
+ - spec/bounded_vars/local_vars_within_block_scope_spec.rb
166
+ - spec/bounded_vars/class_vars_spec.rb
167
+ - spec/bounded_vars/local_vars_spec.rb
168
+ - spec/bounded_vars/global_vars_spec.rb
169
+ - spec/bounded_vars/instance_vars_spec.rb
170
+ - spec/bounded_vars/class_vars_within_block_scope_spec.rb