class Scratchpad::Page

Public Class Methods

new(env) click to toggle source
# File lib/scratchpad/page.rb, line 3
def initialize env
  env[:scratchpad] = self
end

Public Instance Methods

add(content) click to toggle source
# File lib/scratchpad/page.rb, line 7
def add content
  file, line = *caller[1].split(':')
  (@content ||= []) <<  { content: content.dup, file: file, line: line }
end
to_html() click to toggle source
# File lib/scratchpad/page.rb, line 12
def to_html
  return "" unless @content
  ActionView::Base.new(File.dirname(__FILE__)+"../../../app/views").render( 
    file: "scratchpad.html.erb",
    locals: { content: @content }
  )
end