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.



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

def content_type
  @content_type
end

#filename -> String (readonly)

Returns The attachment filename.

Returns:

  • (String)

    The attachment filename.



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

def filename
  @filename
end

#height -> Integer? (readonly)

Returns:

  • (Integer)

    The image height.

  • (nil)

    If the attachment is not an image.



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

def height
  @height
end

#id -> Discorb::Snowflake (readonly)

Returns The attachment id.

Returns:



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

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 31

#io -> #read (readonly)

Returns The file content.

Returns:

  • (#read)

    The file content.



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

def io
  @io
end

#proxy_url -> String (readonly)

Returns The attachment proxy url.

Returns:

  • (String)

    The attachment proxy url.



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

def proxy_url
  @proxy_url
end

#size -> Integer (readonly)

Returns The attachment size in bytes.

Returns:

  • (Integer)

    The attachment size in bytes.



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

def size
  @size
end

#url -> String (readonly)

Returns The attachment url.

Returns:

  • (String)

    The attachment url.



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

def url
  @url
end

#width -> Integer? (readonly)

Returns:

  • (Integer)

    The image width.

  • (nil)

    If the attachment is not an image.



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

def width
  @width
end