Skip to content

Instantly share code, notes, and snippets.

@kitallis
Created July 22, 2012 03:02
Show Gist options
  • Save kitallis/3158107 to your computer and use it in GitHub Desktop.
Save kitallis/3158107 to your computer and use it in GitHub Desktop.
override inner eval()
module Newal
def eval(str)
throw :evaling, [true, Kernel.eval(str)]
end
end
class << self
include Newal
end
$result = catch(:evaling) do
<%= user_code %>
end
class Object
include Kernel
end
def used_eval?
$result.is_a?(Array) ? $result.first : false
end
def user_code
$result.is_a?(Array) ? $result.last : <%= user_code %>
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment