class WeebSh::WeebImage
Represents an image for toph
Attributes
account[R]
@return [String] the ID of the uploader
mime_type[R]
@return [String] the mime type of the image
nsfw[R]
@return [true, false] whether or not this image is nsfw
nsfw?[R]
@return [true, false] whether or not this image is nsfw
source[R]
@return [String, nil] the source of the image
uploader[R]
@return [String] the ID of the uploader
Public Class Methods
new(data, interface)
click to toggle source
@!visibility private
# File lib/weeb/data.rb, line 104 def initialize(data, interface) @interface = interface @id = data['id'] @type = data['type'] @nsfw = data['nsfw'] @file_type = data['fileType'] @mime_type = data['mimeType'] @url = data['url'] @hidden = data['hidden'] @file_type = data['fileType'] @source = data['source'] || nil @account = data['account'] @tags = data['tags'].map { |r| Tag.new(r, interface) } end
Public Instance Methods
add_tag(tag)
click to toggle source
Add a tag to the image @param tag [String, Tag] the affected tag
# File lib/weeb/data.rb, line 133 def add_tag(tag) @interface.add_tags_to_image(self, [tag]) end
delete()
click to toggle source
Delete this image
# File lib/weeb/data.rb, line 144 def delete @interface.delete_image(self) end
Also aliased as: remove
inspect()
click to toggle source
@!visibility private
# File lib/weeb/data.rb, line 150 def inspect "#<WeebSh::WeebImage @url=#{@url.inspect} @type=#{@type.inspect} @nsfw=#{@nsfw.inspect}>" end
remove_tag(tag)
click to toggle source
Remove a tag to the image @param tag [String, Tag] the affected tag
# File lib/weeb/data.rb, line 139 def remove_tag(tag) @interface.remove_tags_to_image(self, [tag]) end