~cytrogen/masto-fe

ref: 685270f3f7ea6d4a8a48ec641e8fdfd9fc2e2d7f masto-fe/app/lib/rss/media_content.rb -rw-r--r-- 718 bytes
685270f3 — Claire [Glitch] Fix clicking “Explore” or “Live feeds” column headers to scroll in advanced mode 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

class RSS::MediaContent < RSS::Element
  def initialize(url, type, size)
    super()

    @root = create_element('media:content') do |content|
      content['url']      = url
      content['type']     = type
      content['fileSize'] = size
    end
  end

  def medium(str)
    @root['medium'] = str
  end

  def rating(str)
    append_element('media:rating', str) do |rating|
      rating['scheme'] = 'urn:simple'
    end
  end

  def description(str)
    append_element('media:description', str) do |description|
      description['type'] = 'plain'
    end
  end

  def thumbnail(str)
    append_element('media:thumbnail') do |thumbnail|
      thumbnail['url'] = str
    end
  end
end