title: Writing code as string with syntax highlighting
body: <p>I am trying to write a ruby source code as a string (as part of real Ruby code) on a text editor with syntax highlighting for Ruby code, but want the Ruby syntax highlighting to work on the code inside the string. Using double or single quotes, percent notation, heredoc all make the text editor recognize that it is a string, so the whole chunk of code is colored in a single color as a string.</p>
  
  <pre><code>&lt;&lt;_
  class Foo
      def bar
          # blah blah
      end
  end
  _
  </code></pre>
  
  <p>Is there a way to let the Ruby syntax highlighting on the editor miss the borders of the string so that  its content is highlightened as Ruby code?</p>
  
  <p><hr></p>
  
  <h3>Edit</h3>
  
  <p>Stefan notices a wonderful feature on Atom, Sublime Text and RubyMine to do this. But unfortunately, it does not seem to work on Emacs ruby mode. Does someone know of a modified <code>ruby-mode.el</code> or a some additional library on emacs to do this?</p>
  
  <h3>Edit</h3>
  
  <p>Or can anyone write a simple elisp code (just to ignore heredoc start and end when the heredoc identifier is <code>RUBY</code> if it is difficult to implement highlighting for other languages)?</p>