Class: WeebSh::WeebImage

Inherits:
PreviewImage show all
Defined in:
lib/weeb/data.rb

Overview

Represents an image for toph

Instance Attribute Summary collapse

Attributes inherited from PreviewImage

#file_type, #type, #url

Attributes included from IDObject

#id

Instance Method Summary collapse

Methods included from IDObject

#==

Instance Attribute Details

#accountString (readonly) Also known as: uploader, author

Returns the ID of the uploader.

Returns:

  • (String)

    the ID of the uploader


95
96
97
# File 'lib/weeb/data.rb', line 95

def 
  @account
end

#hiddentrue, false (readonly) Also known as: hidden?

Returns whether or not this image can only be seen by the uploader.

Returns:

  • (true, false)

    whether or not this image can only be seen by the uploader


88
89
90
# File 'lib/weeb/data.rb', line 88

def hidden
  @hidden
end

#mime_typeString (readonly)

Returns the mime type of the image.

Returns:

  • (String)

    the mime type of the image


82
83
84
# File 'lib/weeb/data.rb', line 82

def mime_type
  @mime_type
end

#nsfwtrue, false (readonly) Also known as: nsfw?

Returns whether or not this image is nsfw.

Returns:

  • (true, false)

    whether or not this image is nsfw


78
79
80
# File 'lib/weeb/data.rb', line 78

def nsfw
  @nsfw
end

#sourceString? (readonly)

Returns the source of the image.

Returns:

  • (String, nil)

    the source of the image


92
93
94
# File 'lib/weeb/data.rb', line 92

def source
  @source
end

#tagsArray<String> (readonly)

Returns the tags on image.

Returns:

  • (Array<String>)

    the tags on image


85
86
87
# File 'lib/weeb/data.rb', line 85

def tags
  @tags
end

Instance Method Details

#add_tag(tag) ⇒ Object

Add a tag to the image

Parameters:

  • tag (String, Tag)

    the affected tag


129
130
131
# File 'lib/weeb/data.rb', line 129

def add_tag(tag)
  @interface.add_tags_to_image(self, [tag])
end

#add_tags(tags) ⇒ Object

Add tags to the image

Parameters:

  • tags (Array<String, Tag>)

    the affected tags


117
118
119
# File 'lib/weeb/data.rb', line 117

def add_tags(tags)
  @interface.add_tags_to_image(self, tags)
end

#deleteObject Also known as: remove

Delete this image


140
141
142
# File 'lib/weeb/data.rb', line 140

def delete
  @interface.delete_image(self)
end

#inspectObject


145
146
147
# File 'lib/weeb/data.rb', line 145

def inspect
  "#<WeebSh::WeebImage @url=#{@url.inspect} @type=#{@type.inspect} @nsfw=#{@nsfw.inspect}>"
end

#remove_tag(tag) ⇒ Object

Remove a tag to the image

Parameters:

  • tags (String, Tag)

    the affected tag


135
136
137
# File 'lib/weeb/data.rb', line 135

def remove_tag(tag)
  @interface.remove_tags_to_image(self, [tag])
end

#remove_tags(tags) ⇒ Object

Remove tags from the image

Parameters:

  • tags (Array<String, Tag>)

    the affected tags


123
124
125
# File 'lib/weeb/data.rb', line 123

def remove_tags(tags)
  @interface.remove_tags_to_image(self, tags)
end