Class: Bridgetown::Webfinger::Properties
- Defined in:
- lib/bridgetown/webfinger/properties.rb
Overview
Class Method Summary collapse
-
.parse(data) ⇒ Properties?
private
Parses and maybe-returns Properties when the value is one.
Methods included from Logging
Class Method Details
.parse(data) ⇒ Properties?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses and maybe-returns Bridgetown::Webfinger::Properties when the value is one
Properties within the JRD are name/value pairs with URIs for names and strings or nulls for values.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bridgetown/webfinger/properties.rb', line 19 def self.parse(data) return unless data unless data.is_a?(Hash) return warn("Webfinger link properties are malformed: #{data.inspect}, ignoring") end properties = data.select do |name, value| if !Webfinger.uri?(name) next warn("Webfinger property name is not a URI: #{name}, ignoring") elsif !value.is_a?(String) || value.nil? next warn("Webfinger property value is not a nullable string: #{value}, ignoring") else true end end if !properties.empty? new(properties) else warn("All Webfinger link properties pruned: #{data.inspect}, ignoring") end end |