Skip to main content
2 of 8
added 141 characters in body
Eric Duminil
  • 1.1k
  • 8
  • 12

Dingus, Ruby

Gets access to putc by listing all the available (private) methods and filter them with regexen. Also redefines p to not do anything:

GET_METHOD = ->x do
  i=0
  while x[0][i]!~x[1] do
    i+=1
  end
  x[0][i]
end
PRIVATE_METHODs=method GET_METHOD[[methods,/^[o-q]ri/]]
PUTC=method GET_METHOD[[PRIVATE_METHODs[],/[o-r]ut[b-d]/]]
DEFINE_METHOD=method GET_METHOD[[PRIVATE_METHODs[],/^de/]]
P=GET_METHOD[[PRIVATE_METHODs[],/^[o-r]\z/]]
DEFINE_METHOD[P]{|x|}
PUTC[34]
PUTC[34]
PUTC[34]
PUTC[13]

Try it online!

Eric Duminil
  • 1.1k
  • 8
  • 12