Class: Texd::Attachment::Dynamic

Inherits:
Struct
  • Object
show all
Defined in:
lib/texd/attachment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentsObject

Returns the value of attribute contents

Returns:

  • (Object)

    the current value of contents



177
178
179
# File 'lib/texd/attachment.rb', line 177

def contents
  @contents
end

#name(with_extension = true) ⇒ Object

rubocop:disable Style/OptionalBooleanParameter



184
185
186
# File 'lib/texd/attachment.rb', line 184

def name
  @name
end

Instance Method Details

#to_upload_ioObject



178
179
180
181
182
# File 'lib/texd/attachment.rb', line 178

def to_upload_io(**)
  Multipart::Post::UploadIO.new(StringIO.new(contents), nil, name).tap { |io|
    io.instance_variable_set :@original_filename, name
  }
end