Class: Primate::UploadedFile

Inherits:
Object
  • Object
show all
Defined in:
lib/primate/uploaded_file.rb,
sig/primate.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field:, name:, type:, size:, bytes:) ⇒ UploadedFile

Returns a new instance of UploadedFile.

Parameters:

  • field: (String)
  • name: (String)
  • type: (String)
  • size: (Integer)
  • bytes: (Object)


9
10
11
12
13
14
15
# File 'lib/primate/uploaded_file.rb', line 9

def initialize(field:, name:, type:, size:, bytes:)
  @field = field
  @filename = name
  @content_type = type
  @size = size
  @io = Primate::Readable.new(bytes, type)
end

Instance Attribute Details

#content_type ⇒ String (readonly)

Returns the value of attribute content_type.

Returns:

  • (String)


7
8
9
# File 'lib/primate/uploaded_file.rb', line 7

def content_type
  @content_type
end

#field ⇒ String (readonly)

Returns the value of attribute field.

Returns:

  • (String)


7
8
9
# File 'lib/primate/uploaded_file.rb', line 7

def field
  @field
end

#filename ⇒ String (readonly)

Returns the value of attribute filename.

Returns:

  • (String)


7
8
9
# File 'lib/primate/uploaded_file.rb', line 7

def filename
  @filename
end

#size ⇒ Integer (readonly)

Returns the value of attribute size.

Returns:

  • (Integer)


7
8
9
# File 'lib/primate/uploaded_file.rb', line 7

def size
  @size
end

Instance Method Details

#io ⇒ Readable

Returns:



17
# File 'lib/primate/uploaded_file.rb', line 17

def io = @io