Class: Archaeo::WarcRecord
- Inherits:
-
Struct
- Object
- Struct
- Archaeo::WarcRecord
- Defined in:
- lib/archaeo/warc_support.rb
Overview
Value object representing a single WARC record.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #content_length ⇒ Object
- #content_type ⇒ Object
- #date ⇒ Object
- #response? ⇒ Boolean
- #target_uri ⇒ Object
- #to_h ⇒ Object
- #warc_type ⇒ Object
- #warcinfo? ⇒ Boolean
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
213 214 215 |
# File 'lib/archaeo/warc_support.rb', line 213 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers
213 214 215 |
# File 'lib/archaeo/warc_support.rb', line 213 def headers @headers end |
#version ⇒ Object
Returns the value of attribute version
213 214 215 |
# File 'lib/archaeo/warc_support.rb', line 213 def version @version end |
Instance Method Details
#content_length ⇒ Object
233 234 235 |
# File 'lib/archaeo/warc_support.rb', line 233 def content_length headers[:content_length].to_i end |
#content_type ⇒ Object
229 230 231 |
# File 'lib/archaeo/warc_support.rb', line 229 def content_type headers[:content_type] end |
#date ⇒ Object
225 226 227 |
# File 'lib/archaeo/warc_support.rb', line 225 def date headers[:warc_date] end |
#response? ⇒ Boolean
237 238 239 |
# File 'lib/archaeo/warc_support.rb', line 237 def response? warc_type == "response" end |
#target_uri ⇒ Object
221 222 223 |
# File 'lib/archaeo/warc_support.rb', line 221 def target_uri headers[:warc_target_uri] end |
#to_h ⇒ Object
245 246 247 |
# File 'lib/archaeo/warc_support.rb', line 245 def to_h { version: version, headers: headers, body_length: body.to_s.bytesize } end |
#warc_type ⇒ Object
217 218 219 |
# File 'lib/archaeo/warc_support.rb', line 217 def warc_type headers[:warc_type] end |
#warcinfo? ⇒ Boolean
241 242 243 |
# File 'lib/archaeo/warc_support.rb', line 241 def warcinfo? warc_type == "warcinfo" end |