Class: Oldskool::PuppetHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/oldskool/puppet_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(params, keyword, config) ⇒ PuppetHandler

Returns a new instance of PuppetHandler.



3
4
5
6
7
8
# File 'lib/oldskool/puppet_handler.rb', line 3

def initialize(params, keyword, config)
  @params = params
  @keyword = keyword
  @config = config
  self
end

Instance Method Details

#handle_request(keyword, query) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/oldskool/puppet_handler.rb', line 14

def handle_request(keyword, query)
  type = Puppetdoc.new(query)

  menu = [{:title => "Type Reference", :url => "http://docs.puppetlabs.com/references/stable/type.html"},
          {:title => "Function Reference", :url => "http://docs.puppetlabs.com/references/stable/function.html"},
          {:title => "Language Guide", :url => "https://docs.puppetlabs.com/puppet/latest/reference/lang_summary.html"}]

  {:template => plugin_template(:type), :type => type.doc, :topmenu => menu}
end

#plugin_template(template) ⇒ Object



10
11
12
# File 'lib/oldskool/puppet_handler.rb', line 10

def plugin_template(template)
  File.read(File.expand_path("../../../views/#{template}.erb", __FILE__))
end