Class: WebStruct::Page::Content
- Inherits:
-
Object
- Object
- WebStruct::Page::Content
- Defined in:
- lib/webstruct/page/content.rb
Overview
Decodes bytes from Content-Type charset, then parses the body by MIME bucket.
Instance Attribute Summary collapse
-
#parsed ⇒ Object
readonly
Returns the value of attribute parsed.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(raw, content_type, type) ⇒ Content
constructor
A new instance of Content.
Constructor Details
#initialize(raw, content_type, type) ⇒ Content
Returns a new instance of Content.
19 20 21 22 23 24 |
# File 'lib/webstruct/page/content.rb', line 19 def initialize(raw, content_type, type) @raw = raw charset = Http::ContentType.charset(content_type) utf8 = Http::ContentType.decode_to_utf8(raw, charset) @parsed = parse(utf8, type) end |
Instance Attribute Details
#parsed ⇒ Object (readonly)
Returns the value of attribute parsed.
14 15 16 |
# File 'lib/webstruct/page/content.rb', line 14 def parsed @parsed end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
14 15 16 |
# File 'lib/webstruct/page/content.rb', line 14 def raw @raw end |