Class: Mack::Caching::PageCaching::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/mack-caching/page_caching/page_caching.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, content_type = "text/html") ⇒ Page

Returns a new instance of Page.



38
39
40
41
42
43
44
45
46
# File 'lib/mack-caching/page_caching/page_caching.rb', line 38

def initialize(body, content_type = "text/html")
  if body.is_a?(Array)
    raise Mack::Errors::UncacheableError.new("Multipart pages can not be cached!") if body.size > 1
    @body = body.first
  else
    @body = body
  end
  @content_type = content_type
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



35
36
37
# File 'lib/mack-caching/page_caching/page_caching.rb', line 35

def body
  @body
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



36
37
38
# File 'lib/mack-caching/page_caching/page_caching.rb', line 36

def content_type
  @content_type
end

Instance Method Details

#to_sObject



48
49
50
# File 'lib/mack-caching/page_caching/page_caching.rb', line 48

def to_s
  @body
end