Module: Pupu::Helpers

Defined in:
lib/pupu/adapters/padrino.rb,
lib/pupu/helpers.rb,
lib/pupu/adapters/rango.rb

Overview

class MyApp < Padrino::Application

register Pupu::Helpers

end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



11
12
13
# File 'lib/pupu/adapters/padrino.rb', line 11

def self.registered(app)
  app.send(:include, self)
end

Instance Method Details

#pupu(name, params = Hash.new) ⇒ Object

Use it in your layout Example: pupu :autocompleter, type: “local”



13
14
15
16
17
# File 'lib/pupu/helpers.rb', line 13

def pupu(name, params = Hash.new)
  comment = if params.empty? then "<!-- Pupu #{name} without params -->"
  else "<!-- Pupu #{name} with params #{params.inspect} -->" end
  [comment, pupu_page.parse(name, params).parse!, "", ""].join("\n")
end

#pupu_pageObject



7
8
9
# File 'lib/pupu/helpers.rb', line 7

def pupu_page
  @page ||= Page.new
end