Class: Hubdown::PageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/hubdown/page_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ PageBuilder

Returns a new instance of PageBuilder.



7
8
9
10
11
12
# File 'lib/hubdown/page_builder.rb', line 7

def initialize args
  @body = args.fetch("body"){ '' }
  @uri = args.fetch("uri"){ 'https://github.com/knomedia/hubdown' }
  @filename = args.fetch("filename"){ '' }
  @style_gen = StyleGenerator.new( @uri )
end

Instance Method Details

#get_pageObject



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

def get_page
  links = @style_gen.get_css_links
  body = @body
  filename = @filename
  template_path = File.dirname(__FILE__) + "/template.html.erb"
  template = ERB.new( File.read( template_path ), nil, "-" )
  page = template.result(binding)
  page      
end