Minor refactoring to kill various Rubocop warnings

This commit is contained in:
Maruno17
2021-12-17 20:29:47 +00:00
parent b5ee1b211d
commit 5dc64f1709
46 changed files with 145 additions and 151 deletions

View File

@@ -13,21 +13,15 @@ class Event
end
# Removes an event handler procedure from the event.
def -(method)
for i in 0...@callbacks.length
next if @callbacks[i]!=method
@callbacks.delete_at(i)
break
end
def -(other)
@callbacks.delete(other)
return self
end
# Adds an event handler procedure from the event.
def +(method)
for i in 0...@callbacks.length
return self if @callbacks[i]==method
end
@callbacks.push(method)
def +(other)
return self if @callbacks.include?(other)
@callbacks.push(other)
return self
end