Class: MtaSts::Fetcher::Body

Inherits:
String
  • Object
show all
Defined in:
lib/mta_sts/fetcher.rb

Overview

RFC 8461 §3.2 SHOULD text/plain — reported, not enforced

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, content_type: nil) ⇒ Body

Returns a new instance of Body.



31
32
33
34
# File 'lib/mta_sts/fetcher.rb', line 31

def initialize(body, content_type: nil)
  super(body)
  @content_type = content_type
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



29
30
31
# File 'lib/mta_sts/fetcher.rb', line 29

def content_type
  @content_type
end

Instance Method Details

#text_plain?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/mta_sts/fetcher.rb', line 36

def text_plain?
  content_type.to_s.split(";").first.to_s.strip.casecmp?("text/plain")
end