Sha256: 804b2754c31999f6f9d1eefa59cb0623d5494a10d95c85423d219dad51b730cf

Contents?: true

Size: 815 Bytes

Versions: 9

Compression:

Stored size: 815 Bytes

Contents

<% begin %>
  <% irb = IRB::Irb.new nil, StringInputMethod.new(script + "\nexit\n") %>
  <% IRB.conf[:MAIN_CONTEXT] = irb.context %>
  <% IRB.conf[:OUTPUT] = [] %>

  <% begin %>
    <% irb.eval_input %>
    <% IRB.Output.each do |key, line| %>
      <% case key
         when :stdin %>
        <p class="text-info"><%= h line %></p>
      <% when :stdout %>
        <p><%= h line %></p>
      <% when :stderr %>
        <p class="text-danger"><%= h line %></p>
      <% end %>
    <% end %>
  <% rescue => error %>
    <p class="text-danger"><%= h error.class %>: <%= h error.message %></p>
    <% error.backtrace.each do |backtrace| %>
      <p class="text-danger">    <%= h backtrace %></p>
    <% end %>
  <% end %>

<% rescue => error %>
  <%= erb :error, locals: { error: error }, layout: false %>
<% end %>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tailog-0.6.8 app/views/script/ruby.erb
tailog-0.6.7 app/views/script/ruby.erb
tailog-0.6.6 app/views/script/ruby.erb
tailog-0.6.5 app/views/script/ruby.erb
tailog-0.6.4 app/views/script/ruby.erb
tailog-0.6.3 app/views/script/ruby.erb
tailog-0.6.2 app/views/script/ruby.erb
tailog-0.6.1 app/views/script/ruby.erb
tailog-0.6.0 app/views/script/ruby.erb