Class: Virginia::DocumentCache::Document
- Inherits:
-
Struct
- Object
- Struct
- Virginia::DocumentCache::Document
- Defined in:
- lib/virginia/document_cache/document.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lifetime ⇒ Object
Returns the value of attribute lifetime.
Instance Method Summary collapse
-
#initialize(id, body, content_type = 'text/plain', lifetime = nil) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(id, body, content_type = 'text/plain', lifetime = nil) ⇒ Document
Returns a new instance of Document.
6 7 8 9 10 11 12 |
# File 'lib/virginia/document_cache/document.rb', line 6 def initialize(id, body, content_type = 'text/plain', lifetime = nil) self.id, self.body, self.content_type, self.lifetime = id, body, content_type, lifetime self.created_at = Time.now if self.lifetime self.expires_at = self.created_at + self.lifetime end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
5 6 7 |
# File 'lib/virginia/document_cache/document.rb', line 5 def body @body end |
#content_type ⇒ Object
Returns the value of attribute content_type
5 6 7 |
# File 'lib/virginia/document_cache/document.rb', line 5 def content_type @content_type end |
#created_at ⇒ Object
Returns the value of attribute created_at
5 6 7 |
# File 'lib/virginia/document_cache/document.rb', line 5 def created_at @created_at end |
#expires_at ⇒ Object
Returns the value of attribute expires_at
5 6 7 |
# File 'lib/virginia/document_cache/document.rb', line 5 def expires_at @expires_at end |
#id ⇒ Object
Returns the value of attribute id
5 6 7 |
# File 'lib/virginia/document_cache/document.rb', line 5 def id @id end |
#lifetime ⇒ Object
Returns the value of attribute lifetime
5 6 7 |
# File 'lib/virginia/document_cache/document.rb', line 5 def lifetime @lifetime end |