You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
385 B

  1. # frozen_string_literal: true
  2. class ActivityPub::Parser::CustomEmojiParser
  3. include JsonLdHelper
  4. def initialize(json)
  5. @json = json
  6. end
  7. def uri
  8. @json['id']
  9. end
  10. def shortcode
  11. @json['name']&.delete(':')
  12. end
  13. def image_remote_url
  14. @json.dig('icon', 'url')
  15. end
  16. def updated_at
  17. @json['updated']&.to_datetime
  18. rescue ArgumentError
  19. nil
  20. end
  21. end