Class: Mailkube::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/mailkube/types.rb,
sig/mailkube/types.rbs

Overview

Response and parameter models.

Two shapes matter here, and both were arrived at by testing Steep 2.0.0 rather than guessing.

In lib/, each model is class X < Data.define(...), not X = Data.define(...) do ... end. Steep attributes the block form's methods to the enclosing module rather than to the constant, and then cannot resolve the generated readers from inside them.

Here, each is declared as a plain class X and does not name ::Data as its superclass. Inheriting ::Data in the signature brings its own untyped new along, which shadows the keyword-argument initialize below, and every call site then fails with "unexpected keyword argument".

The generated readers are declared as attr_reader; Ruby::MethodDefinitionMissing stays off in the Steepfile because Steep cannot see their implementations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename:, content:, content_type: nil) ⇒ Attachment

Returns a new instance of Attachment.

Parameters:

  • filename (String)

    the name of the attached file.

  • content (String)

    the raw file content.

  • content_type (String, nil) (defaults to: nil)

    the MIME type, inferred from the filename when nil.

  • filename: (String)
  • content: (String)
  • content_type: (String, nil) (defaults to: nil)


12
# File 'lib/mailkube/types.rb', line 12

def initialize(filename:, content:, content_type: nil) = super

Instance Attribute Details

#contentString (readonly)

Returns the value of attribute content.

Returns:

  • (String)


19
20
21
# File 'sig/mailkube/types.rbs', line 19

def content
  @content
end

#content_typeString? (readonly)

Returns the value of attribute content_type.

Returns:

  • (String, nil)


20
21
22
# File 'sig/mailkube/types.rbs', line 20

def content_type
  @content_type
end

#filenameString (readonly)

Returns the value of attribute filename.

Returns:

  • (String)


18
19
20
# File 'sig/mailkube/types.rbs', line 18

def filename
  @filename
end