Module: DiasporaFederation::Federation::DiasporaUrlParser

Includes:
Logging
Defined in:
lib/diaspora_federation/federation/diaspora_url_parser.rb

Overview

This module is for parsing and fetching linked entities.

Constant Summary collapse

DIASPORA_URL_REGEX =

Regex to find diaspora:// URLs

%r{
  diaspora://
  (#{Validation::Rule::DiasporaId::DIASPORA_ID_REGEX})/
  (#{Entity::ENTITY_NAME_REGEX})/
  (#{Validation::Rule::Guid::VALID_CHARS})
}ux

Class Method Summary collapse

Methods included from Logging

included

Class Method Details

.fetch_linked_entities(text) ⇒ Object

Parses all diaspora:// URLs from the text and fetches the entities from the remote server if needed.


19
20
21
22
23
# File 'lib/diaspora_federation/federation/diaspora_url_parser.rb', line 19

def self.fetch_linked_entities(text)
  text.scan(DIASPORA_URL_REGEX).each do |author, type, guid|
    fetch_entity(author, type, guid)
  end
end