Skip to content

Instantly share code, notes, and snippets.

@rick

rick/hero.rb Secret

Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rick/2dfd402d598113ef9729 to your computer and use it in GitHub Desktop.
Save rick/2dfd402d598113ef9729 to your computer and use it in GitHub Desktop.
Come for the `set -e`, stay for the `|| true`
>> class Object
>> def set(other)
>> other
>> end
>>
?> def e
>> Hero.new
>> end
>> end
=> :e
>>
?> class Hero
>> def -@()
>> puts "PRODUCTION HERO SAFETY LEVEL ENGAGE!"
>> end
>> end
=> :-@
>> set -e
PRODUCTION HERO SAFETY LEVEL ENGAGE!
=> nil
>> class Hero
>> def +@()
>> puts "DISENGAGED. FIGHT STRONG, HERO."
>> end
>> end
=> :+@
>> set +e
DISENGAGED. FIGHT STRONG, HERO.
=> nil
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment