Class: Discorb::Attachment

Inherits:
DiscordModel show all
Defined in:
lib/discorb/file.rb

Overview

Represents a attachment file.

Instance Attribute Summary collapse

Method Summary

Methods inherited from DiscordModel

#==, #eql?, #hash

Instance Attribute Details

#content_type -> String (readonly)

Returns The attachment content type.

Returns:

  • (String)

    The attachment content type.



18
19
20
# File 'lib/discorb/file.rb', line 18

def content_type
  @content_type
end

#filename -> String (readonly)

Returns The attachment filename.

Returns:

  • (String)

    The attachment filename.



16
17
18
# File 'lib/discorb/file.rb', line 16

def filename
  @filename
end

#height -> Integer? (readonly)

Returns:

  • (Integer)

    The image height.

  • (nil)

    If the attachment is not an image.



27
28
29
# File 'lib/discorb/file.rb', line 27

def height
  @height
end

#id -> Discorb::Snowflake (readonly)

Returns The attachment id.

Returns:



14
15
16
# File 'lib/discorb/file.rb', line 14

def id
  @id
end

#image? -> Boolean (readonly)

Returns whether the file is an image.

Returns:

  • (Boolean)

    whether the file is an image.



# File 'lib/discorb/file.rb', line 32

#io -> #read (readonly)

Returns The file content.

Returns:

  • (#read)

    The file content.



12
13
14
# File 'lib/discorb/file.rb', line 12

def io
  @io
end

#proxy_url -> String (readonly)

Returns The attachment proxy url.

Returns:

  • (String)

    The attachment proxy url.



24
25
26
# File 'lib/discorb/file.rb', line 24

def proxy_url
  @proxy_url
end

#size -> Integer (readonly)

Returns The attachment size in bytes.

Returns:

  • (Integer)

    The attachment size in bytes.



20
21
22
# File 'lib/discorb/file.rb', line 20

def size
  @size
end

#url -> String (readonly)

Returns The attachment url.

Returns:

  • (String)

    The attachment url.



22
23
24
# File 'lib/discorb/file.rb', line 22

def url
  @url
end

#width -> Integer? (readonly)

Returns:

  • (Integer)

    The image width.

  • (nil)

    If the attachment is not an image.



30
31
32
# File 'lib/discorb/file.rb', line 30

def width
  @width
end