Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -38,13 +38,13 @@ class Event
# proc { |sender,params| } where params is an array of the other parameters, and
# proc { |sender,arg0,arg1,...| }
def trigger(*arg)
arglist = arg[1,arg.length]
arglist = arg[1, arg.length]
for callback in @callbacks
if callback.arity>2 && arg.length==callback.arity
if callback.arity > 2 && arg.length == callback.arity
# Retrofitted for callbacks that take three or more arguments
callback.call(*arg)
else
callback.call(arg[0],arglist)
callback.call(arg[0], arglist)
end
end
end
@@ -84,7 +84,7 @@ class HandlerHash
mod = Object.const_get(@mod) rescue nil
return nil if !mod
for key in mod.constants
next if mod.const_get(key)!=sym
next if mod.const_get(key) != sym
ret = key.to_sym
@symbolCache[sym] = ret
break
@@ -92,15 +92,15 @@ class HandlerHash
return ret
end
def addIf(conditionProc,handler = nil,&handlerBlock)
if ![Proc,Hash].include?(handler.class) && !block_given?
def addIf(conditionProc, handler = nil, &handlerBlock)
if ![Proc, Hash].include?(handler.class) && !block_given?
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
end
@addIfs.push([conditionProc,handler || handlerBlock])
@addIfs.push([conditionProc, handler || handlerBlock])
end
def add(sym,handler = nil,&handlerBlock) # 'sym' can be an ID or symbol
if ![Proc,Hash].include?(handler.class) && !block_given?
def add(sym, handler = nil, &handlerBlock) # 'sym' can be an ID or symbol
if ![Proc, Hash].include?(handler.class) && !block_given?
raise ArgumentError, "#{self.class.name} for #{sym.inspect} has no valid handler (#{handler.inspect} was given)"
end
id = fromSymbol(sym)
@@ -109,11 +109,11 @@ class HandlerHash
@hash[symbol] = handler || handlerBlock if symbol
end
def copy(src,*dests)
def copy(src, *dests)
handler = self[src]
if handler
for dest in dests
self.add(dest,handler)
self.add(dest, handler)
end
end
end
@@ -132,9 +132,9 @@ class HandlerHash
return ret
end
def trigger(sym,*args)
def trigger(sym, *args)
handler = self[sym]
return (handler) ? handler.call(fromSymbol(sym),*args) : nil
return (handler) ? handler.call(fromSymbol(sym), *args) : nil
end
def clear
@@ -221,7 +221,7 @@ class HandlerHashBasic
end
def add(entry, handler = nil, &handlerBlock)
if ![Proc,Hash].include?(handler.class) && !block_given?
if ![Proc, Hash].include?(handler.class) && !block_given?
raise ArgumentError, "#{self.class.name} for #{entry.inspect} has no valid handler (#{handler.inspect} was given)"
end
return if !entry || entry.empty?