In 1.7.24 I’ve added Ruby and Ruby on Rails as a language on Crayon. Even cooler, I’ve added the <% ... %> and similar delimiter tags for eRuby/RHTML. Using Multiple Language Highlighting in Crayon, you can choose HTML as the base language with the lang="html" attribute or the $[html]...[/html] Mini Tag and then through in some eRuby syntax. The red bits are Ruby, all else is XHTML. Note you can do the same thing with PHP tags, CSS tags and JavaScript tags. Here’s the shortcode I used:
Some HTML first.

    <% 3.times do %>
  • list item
  • <% end %> % $s("ewfwe")
<%= "print something" %> Tada. [/html]
Here’s some Ruby: And the shortcode:
$[rb toolbar="always"]
def create_set_and_get(initial_value=0) # Note the default value of 0
  closure_value = initial_value
  return {|x| closure_value = x}, { closure_value }
setter, getter = create_set_and_get  # ie. returns two values # => 21
#You can also use a parameter variable as a binding for the closure. 
#So the above can be rewritten as...
def create_set_and_get(closure_value=0)
  return proc {|x| closure_value = x } , proc { closure_value }

proc {|arg| print arg} {|arg| print arg}
lambda {|arg| print arg}
# introduced in Ruby 1.9
->(arg) {print arg}

# In an object instance variable (denoted with '@'), remember a block.
def remember(&a_block)
  @block = a_block
# Invoke the above method, giving it a block which takes a name.
remember {|name| puts "Hello, #{name}!"}
# When the time is right (for the object) -- call the closure!"Jon")
# => "Hello, Jon!"