mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Merge pull request #87 from weilu/remove_unused_variables
Remove assigned but unused variables
This commit is contained in:
@@ -23,7 +23,7 @@ class AboutBlocks < EdgeCase::Koan
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_blocks_can_take_arguments
|
def test_blocks_can_take_arguments
|
||||||
result = method_with_block_arguments do |argument|
|
method_with_block_arguments do |argument|
|
||||||
assert_equal __("Jim"), argument
|
assert_equal __("Jim"), argument
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class AboutExceptions < EdgeCase::Koan
|
|||||||
result = nil
|
result = nil
|
||||||
begin
|
begin
|
||||||
fail "Oops"
|
fail "Oops"
|
||||||
rescue StandardError => ex
|
rescue StandardError
|
||||||
# no code here
|
# no code here
|
||||||
ensure
|
ensure
|
||||||
result = :always_run
|
result = :always_run
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class AboutSandwichCode < EdgeCase::Koan
|
|||||||
def count_lines(file_name)
|
def count_lines(file_name)
|
||||||
file = open(file_name)
|
file = open(file_name)
|
||||||
count = 0
|
count = 0
|
||||||
while line = file.gets
|
while file.gets
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
count
|
count
|
||||||
@@ -66,7 +66,7 @@ class AboutSandwichCode < EdgeCase::Koan
|
|||||||
def count_lines2(file_name)
|
def count_lines2(file_name)
|
||||||
file_sandwich(file_name) do |file|
|
file_sandwich(file_name) do |file|
|
||||||
count = 0
|
count = 0
|
||||||
while line = file.gets
|
while file.gets
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
count
|
count
|
||||||
@@ -99,7 +99,7 @@ class AboutSandwichCode < EdgeCase::Koan
|
|||||||
def count_lines3(file_name)
|
def count_lines3(file_name)
|
||||||
open(file_name) do |file|
|
open(file_name) do |file|
|
||||||
count = 0
|
count = 0
|
||||||
while line = file.gets
|
while file.gets
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
count
|
count
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class AboutScope < EdgeCase::Koan
|
|||||||
|
|
||||||
def test_dog_is_not_available_in_the_current_scope
|
def test_dog_is_not_available_in_the_current_scope
|
||||||
assert_raise(___(NameError)) do
|
assert_raise(___(NameError)) do
|
||||||
fido = Dog.new
|
Dog.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user