Ruby

To use this language, use the class "language-ruby".

Comments

# This is a comment
=begin
Multi-line
comment
=end

Strings

"foo \"bar\" baz"
'foo \'bar\' baz'

Regular expressions

/foo?[ ]*bar/

Variables

$foo = 5;
class InstTest
  def set_foo(n)
    @foo = n
  end
  def set_bar(n)
    @bar = n
  end
end

Symbols

mystring = :steveT;

String Interpolation

"foo #{'bar'+my_variable}"

Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

Comments that look like interpolation show as ruby code

#{my_var}

Multi-line comments are not supported

=begin
************************
This is a comment block
************************
=end