Dingus, Ruby and Dingus, Ruby
One password for both Ruby challenges by Dingus is:
G=->*x{i=0;i+=1 while x[0][i]!~x[1];x[0][i]};Q=method G[methods,/^[o-q]ri/];C=method G[q=Q[],/[o-r]ut[b-d]/];D=method G[q,/^de/];P=G[q,/^[o-r]\z/];D[P]{|x|};C[34];C[34];C[34];C[10]
Try it online! & Try it online!
- Gets access to
putc
by listing all the available (private) methods and filters them with regexen. - Also redefines
p
to not do anything. - a lambda is used instead of
def
method :method_name
with[]
is used instead of()
.
cannot be used, so only the methods forObject
andKernel
are available- Since
putc
is available, any string could be written.
FORTRAN like code:
GET_METHODGREP = ->*xlambda do |l,r|
i=0
while x[0][i]l[i]!~x[1]~r do
i+=1
end
x[0][i]l[i]
end
PRIVATE_METHODs=method GET_METHOD[methodsGREP[methods,/^[o-q]ri/]
PUTC=method GET_METHOD[PRIVATE_METHODs[]GREP[PRIVATE_METHODs[],/[o-r]ut[b-d]/]
DEFINE_METHOD=method GET_METHOD[PRIVATE_METHODs[]GREP[PRIVATE_METHODs[],/^de/]
P=GET_METHOD[PRIVATE_METHODs[]P=GREP[PRIVATE_METHODs[],/^[o-r]\z/]
DEFINE_METHOD[P]{|x|}
PUTC[34]
PUTC[34]
PUTC[34]
PUTC[10]