Class: Rack::PageCaching::Middleware::Page
- Inherits:
-
Object
- Object
- Rack::PageCaching::Middleware::Page
- Defined in:
- lib/rack_page_caching/rack_page_caching.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
Instance Method Summary collapse
-
#initialize(body, content_type = "text/html") ⇒ Page
constructor
A new instance of Page.
- #to_s ⇒ Object
Constructor Details
#initialize(body, content_type = "text/html") ⇒ Page
Returns a new instance of Page.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rack_page_caching/rack_page_caching.rb', line 48 def initialize(body, content_type = "text/html") if body.is_a?(Array) raise ArgumentError.new("Multipart pages can not be cached!") if body.size > 1 @body = body.first else @body = body end unless @body.nil? @body << "\n<!-- Page created at: #{Time.now} -->" end @content_type = content_type end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
45 46 47 |
# File 'lib/rack_page_caching/rack_page_caching.rb', line 45 def body @body end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
46 47 48 |
# File 'lib/rack_page_caching/rack_page_caching.rb', line 46 def content_type @content_type end |
Instance Method Details
#to_s ⇒ Object
61 62 63 |
# File 'lib/rack_page_caching/rack_page_caching.rb', line 61 def to_s @body end |