Html-R
"Making your ruby code pretty"
Paste your ruby code here, then twiddle your thumbs for a moment...
demo code
... and the pretty ruby code will be written here ...
... with the corresponding html and css code printed here...
# Why's (Poignant) Guide to Ruby - The Endertrombe Wishmaker
require 'endertromb'
class WishMaker
def initialize
@energy = rand( 6 )
end
def grant( wish )
if wish.length > 10 or wish.include? ' '
raise ArgumentError, "Bad wish."
end
if @energy.zero?
raise Exception, "No energy left."
end
@energy -= 1
Endertromb::make( wish )
end
end
#!ruby -Ku
module Kernel
def ∑( *args ) # Sum of
args.inject( 0 ) { |i, j| i += j }
end
def √( number ) # Root of
Math.sqrt( number )
end
end
puts √(49)
puts ∑(1,2,3,4,5)