Skip to content

Commit 5d665b6

Browse files
committed
Fix code style and use do/end blocks instead of {} for Module.new call
1 parent 3c5f2de commit 5d665b6

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

spec/ruby/core/module/module_function_spec.rb

+21-21
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ def test1; end
206206

207207
describe "Module#module_function as a toggle (no arguments) in a Module body" do
208208
it "makes any subsequently defined methods module functions with the normal semantics" do
209-
m = Module.new {
209+
m = Module.new do
210210
module_function
211211
def test1() end
212212
def test2() end
213-
}
213+
end
214214

215215
m.respond_to?(:test1).should == true
216216
m.respond_to?(:test2).should == true
@@ -234,13 +234,13 @@ def test2() end
234234

235235
it "stops creating module functions if the body encounters another toggle " \
236236
"like public/protected/private without arguments" do
237-
m = Module.new {
237+
m = Module.new do
238238
module_function
239239
def test1() end
240240
def test2() end
241241
public
242242
def test3() end
243-
}
243+
end
244244

245245
m.respond_to?(:test1).should == true
246246
m.respond_to?(:test2).should == true
@@ -249,82 +249,82 @@ def test3() end
249249

250250
it "does not stop creating module functions if the body encounters " \
251251
"public/protected/private WITH arguments" do
252-
m = Module.new {
252+
m = Module.new do
253253
def foo() end
254254
module_function
255255
def test1() end
256256
def test2() end
257257
public :foo
258258
def test3() end
259-
}
259+
end
260260

261261
m.respond_to?(:test1).should == true
262262
m.respond_to?(:test2).should == true
263263
m.respond_to?(:test3).should == true
264264
end
265265

266266
it "does not affect module_evaled method definitions also if outside the eval itself" do
267-
m = Module.new {
267+
m = Module.new do
268268
module_function
269269
module_eval { def test1() end }
270270
module_eval " def test2() end "
271-
}
271+
end
272272

273273
m.respond_to?(:test1).should == false
274274
m.respond_to?(:test2).should == false
275275
end
276276

277277
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
279279
module_eval { module_function }
280280
def test1() end
281281
def test2() end
282-
}
282+
end
283283

284284
m.respond_to?(:test1).should == false
285285
m.respond_to?(:test2).should == false
286286
end
287287

288288
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
291291
module_function
292292
def test1() end
293293
def test2() end
294-
}
295-
}
294+
end
295+
end
296296

297297
m.respond_to?(:test1).should == true
298298
m.respond_to?(:test2).should == true
299299
end
300300

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
303303
module_function
304304
eval "def test1() end"
305-
}
305+
end
306306

307307
m.respond_to?(:test1).should == true
308308
end
309309

310310
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
312312
eval "module_function"
313313
def test1() end
314-
}
314+
end
315315

316316
m.respond_to?(:test1).should == false
317317
end
318318

319319
it "functions normally if both toggle and definitions inside a eval" do
320-
m = Module.new {
320+
m = Module.new do
321321
eval <<-CODE
322322
module_function
323323
324324
def test1() end
325325
def test2() end
326326
CODE
327-
}
327+
end
328328

329329
m.respond_to?(:test1).should == true
330330
m.respond_to?(:test2).should == true

0 commit comments

Comments
 (0)