1
0

media_content.rb 718 B

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. class RSS::MediaContent < RSS::Element
  3. def initialize(url, type, size)
  4. super()
  5. @root = create_element('media:content') do |content|
  6. content['url'] = url
  7. content['type'] = type
  8. content['fileSize'] = size
  9. end
  10. end
  11. def medium(str)
  12. @root['medium'] = str
  13. end
  14. def rating(str)
  15. append_element('media:rating', str) do |rating|
  16. rating['scheme'] = 'urn:simple'
  17. end
  18. end
  19. def description(str)
  20. append_element('media:description', str) do |description|
  21. description['type'] = 'plain'
  22. end
  23. end
  24. def thumbnail(str)
  25. append_element('media:thumbnail') do |thumbnail|
  26. thumbnail['url'] = str
  27. end
  28. end
  29. end