Class: Scratchpad::Page
- Inherits:
-
Object
- Object
- Scratchpad::Page
- Defined in:
- lib/scratchpad/page.rb
Instance Method Summary collapse
- #add(content) ⇒ Object
-
#initialize(env) ⇒ Page
constructor
A new instance of Page.
- #to_html ⇒ Object
Constructor Details
#initialize(env) ⇒ Page
Returns a new instance of Page.
3 4 5 |
# File 'lib/scratchpad/page.rb', line 3 def initialize env env[:scratchpad] = self end |
Instance Method Details
#add(content) ⇒ Object
7 8 9 |
# File 'lib/scratchpad/page.rb', line 7 def add content (@content ||= []) << content end |
#to_html ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/scratchpad/page.rb', line 11 def to_html return "" unless @content %Q{ <div id="scratchpad"> #{@content.map { |i| "<div class='scratch'>#{i}</div>" }.join} </div> } end |