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.



42
43
44
45
# File 'lib/mta_sts/fetcher.rb', line 42

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.



40
41
42
# File 'lib/mta_sts/fetcher.rb', line 40

def content_type
  @content_type
end

Instance Method Details

#text_plain?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/mta_sts/fetcher.rb', line 47

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