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.



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

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.



25
26
27
# File 'lib/mta_sts/fetcher.rb', line 25

def content_type
  @content_type
end

Instance Method Details

#text_plain?Boolean

Returns:

  • (Boolean)


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

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