title: What is the meaning of the percent sign + pipe operator in Ruby, as in "%|"?
body: <p>I'm trying to understand the script presented on <a href="http://metaskills.net/2010/07/09/interactive-javascript-console-with-textmate/" rel="noreferrer">this site</a>:</p>
  
  <pre><code>#!/usr/bin/env ruby
  
  require ENV['TM_SUPPORT_PATH'] + '/lib/escape.rb'
  
  def terminal_script_filepath
    %|tell application "Terminal"
        activate
        do script "jsc -i #{e_as(e_sh(ENV['TM_FILEPATH']))}"
      end tell|
  end
  
  open("|osascript", "w") { |io| io &lt;&lt; terminal_script_filepath }
  </code></pre>
  
  <p>Most importantly, the part where the function <code>terminal_script_filepath</code> begins with:</p>
  
  <pre><code>%| …
  … |
  </code></pre>
  
  <p>… and where it is "parsed" in:</p>
  
  <pre><code>{ |io| io &lt;&lt; terminal_script_filepath }
  </code></pre>
  
  <p><strong>Which concepts of Ruby are used here?</strong> </p>
  
  <p>I know that <code>open()</code> with a pipe helps me feed input to the STDIN of a process, but how does the input get from <code>terminal_script_filepath</code> to <code>io</code>? I also know the <a href="http://old.blog.jimhoskins.com/?p=8" rel="noreferrer">basic <code>%</code> operations with strings</a>, like <code>%w</code>, but what does the pipe do here?</p>