Class: Whisper::Page

Inherits:
Object
  • Object
show all
Includes:
Dependency, Loggy
Defined in:
lib/whisper/page.rb

Defined Under Namespace

Classes: HTMLBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dependency

#content, #dependency_init, #refresh!, #timestamp

Constructor Details

#initialize(opts, &rebuilder) ⇒ Page

kind of insane the amount of stuff this thing actually needs



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/whisper/page.rb', line 12

def initialize opts, &rebuilder
  @format = opts[:format]
  @url_vars = opts[:url_vars] # used for making links to related pages
  @master_template = opts[:master_template]
  @template = opts[:template]
  @helper = opts[:helper]
  @rebuilder = rebuilder
  @dependencies = opts[:extra_deps] + [@master_template, @template, @helper]
  @config = opts[:config]
  @router = opts[:router]
  @entryset = opts[:entryset]

  dependency_init
end

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



27
28
29
# File 'lib/whisper/page.rb', line 27

def dependencies
  @dependencies
end

Instance Method Details

#content_typeObject



29
30
31
32
33
34
35
36
# File 'lib/whisper/page.rb', line 29

def content_type
  case @format
  when "html"; "text/html"
  when "rss"; "application/rss+xml"
  when "txt"; "text/plain"
  else raise "unknown format #@format"
  end
end