Skip to content

Instantly share code, notes, and snippets.

@baweaver
Created February 2, 2022 02:10
Show Gist options
  • Save baweaver/ce40797c1eb98f1d1b95e2f0c2f2739b to your computer and use it in GitHub Desktop.
Save baweaver/ce40797c1eb98f1d1b95e2f0c2f2739b to your computer and use it in GitHub Desktop.
I present to you a horror from the depths, programming Ruby without the letter "e"
c = '' << 101
SUB = /___/
subs = -> s { s.gsub(SUB, c) }
fn = "/tmp/runs.rb"
# Patch it in for fun
`#{c}cho 'alias run #{subs['___val']}' > #{fn}`
load fn
mm = <<~ABC
d___f m___thod_missing(m___th, *a, &f)
c = '' << 101
m___th_nam___ = m___th.to_s
normal_nam___ = m___th_nam___.gsub(SUB) { c }
if SUB.match?(m___th) && s___lf.r___spond_to?(normal_nam___)
s___lf.s___nd(normal_nam___, *a, &f)
___ls___
sup___r
___nd
___nd
ABC
run subs[mm]
p subs["s___l___ct"], [1,2,3].s___l___ct(&:"#{c}v#{c}n?")
p subs["r___duc___"], [1,2,3].r___duc___(0) { |a, i| a + i }
# ------- OUT -------
"select"
[2]
"reduce"
6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment