@@ -206,11 +206,11 @@ def test1; end
206
206
207
207
describe "Module#module_function as a toggle (no arguments) in a Module body" do
208
208
it "makes any subsequently defined methods module functions with the normal semantics" do
209
- m = Module . new {
209
+ m = Module . new do
210
210
module_function
211
211
def test1 ( ) end
212
212
def test2 ( ) end
213
- }
213
+ end
214
214
215
215
m . respond_to? ( :test1 ) . should == true
216
216
m . respond_to? ( :test2 ) . should == true
@@ -234,13 +234,13 @@ def test2() end
234
234
235
235
it "stops creating module functions if the body encounters another toggle " \
236
236
"like public/protected/private without arguments" do
237
- m = Module . new {
237
+ m = Module . new do
238
238
module_function
239
239
def test1 ( ) end
240
240
def test2 ( ) end
241
241
public
242
242
def test3 ( ) end
243
- }
243
+ end
244
244
245
245
m . respond_to? ( :test1 ) . should == true
246
246
m . respond_to? ( :test2 ) . should == true
@@ -249,82 +249,82 @@ def test3() end
249
249
250
250
it "does not stop creating module functions if the body encounters " \
251
251
"public/protected/private WITH arguments" do
252
- m = Module . new {
252
+ m = Module . new do
253
253
def foo ( ) end
254
254
module_function
255
255
def test1 ( ) end
256
256
def test2 ( ) end
257
257
public :foo
258
258
def test3 ( ) end
259
- }
259
+ end
260
260
261
261
m . respond_to? ( :test1 ) . should == true
262
262
m . respond_to? ( :test2 ) . should == true
263
263
m . respond_to? ( :test3 ) . should == true
264
264
end
265
265
266
266
it "does not affect module_evaled method definitions also if outside the eval itself" do
267
- m = Module . new {
267
+ m = Module . new do
268
268
module_function
269
269
module_eval { def test1 ( ) end }
270
270
module_eval " def test2() end "
271
- }
271
+ end
272
272
273
273
m . respond_to? ( :test1 ) . should == false
274
274
m . respond_to? ( :test2 ) . should == false
275
275
end
276
276
277
277
it "has no effect if inside a module_eval if the definitions are outside of it" do
278
- m = Module . new {
278
+ m = Module . new do
279
279
module_eval { module_function }
280
280
def test1 ( ) end
281
281
def test2 ( ) end
282
- }
282
+ end
283
283
284
284
m . respond_to? ( :test1 ) . should == false
285
285
m . respond_to? ( :test2 ) . should == false
286
286
end
287
287
288
288
it "functions normally if both toggle and definitions inside a module_eval" do
289
- m = Module . new {
290
- module_eval {
289
+ m = Module . new do
290
+ module_eval do
291
291
module_function
292
292
def test1 ( ) end
293
293
def test2 ( ) end
294
- }
295
- }
294
+ end
295
+ end
296
296
297
297
m . respond_to? ( :test1 ) . should == true
298
298
m . respond_to? ( :test2 ) . should == true
299
299
end
300
300
301
- it "affects evaled method definitions also even when outside the eval itself" do
302
- m = Module . new {
301
+ it "affects eval'ed method definitions also even when outside the eval itself" do
302
+ m = Module . new do
303
303
module_function
304
304
eval "def test1() end"
305
- }
305
+ end
306
306
307
307
m . respond_to? ( :test1 ) . should == true
308
308
end
309
309
310
310
it "doesn't affect definitions when inside an eval even if the definitions are outside of it" do
311
- m = Module . new {
311
+ m = Module . new do
312
312
eval "module_function"
313
313
def test1 ( ) end
314
- }
314
+ end
315
315
316
316
m . respond_to? ( :test1 ) . should == false
317
317
end
318
318
319
319
it "functions normally if both toggle and definitions inside a eval" do
320
- m = Module . new {
320
+ m = Module . new do
321
321
eval <<-CODE
322
322
module_function
323
323
324
324
def test1() end
325
325
def test2() end
326
326
CODE
327
- }
327
+ end
328
328
329
329
m . respond_to? ( :test1 ) . should == true
330
330
m . respond_to? ( :test2 ) . should == true
0 commit comments