Class: Weasyl::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/weasyl/media.rb

Overview

A relationship between MediaItems

Author:

  • Maxine Michalski

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, link) ⇒ Object

Initializer for link object

Author:

  • Maxine Michalski

Since:

  • 0.1.0



144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/weasyl/media.rb', line 144

def initialize(type, link)
  case @type = type
  when :cover
    @links = link.map { |l| Weasyl::Cover.new(l) }
  when :thumbnail
    @links = link.map { |l| Weasyl::Thumbnail.new(l) }
  when :submission
    @links = link.map { |l| Weasyl::MediaFile.new(l) }
  else
    raise ArgumentError, "Unknown type: #{@type}"
  end
end

Instance Attribute Details

Returns Items that are linked to.

Returns:

Since:

  • 0.1.0



138
139
140
# File 'lib/weasyl/media.rb', line 138

def links
  @links
end

#typeSymbol (readonly)

Returns Type of item this link links.

Returns:

  • (Symbol)

    Type of item this link links

Since:

  • 0.1.0



135
136
137
# File 'lib/weasyl/media.rb', line 135

def type
  @type
end