Class: Bridgetown::Webfinger::Titles
- Defined in:
- lib/bridgetown/webfinger/titles.rb
Overview
Wraps a ‘titles` member within a Link
Class Method Summary collapse
-
.parse(data) ⇒ Titles?
private
Parses and maybe-returns Titles when the value is one.
Methods included from Logging
Class Method Details
.parse(data) ⇒ Titles?
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::Titles when the value is one
Titles within the JRD are name/value pairs [with language tag names and string values]. When the language is indeterminate, use ‘“und”`.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bridgetown/webfinger/titles.rb', line 19 def self.parse(data) return unless data.is_a?(Hash) data = data.select do |key, value| if !key.is_a?(String) next warn("Webfinger title key is not a string: #{key}, ignoring") elsif !value.is_a?(String) next warn("Webfinger title value for #{key} is not a string: #{value}, ignoring") else true end end if !data.empty? new(data) else warn("All Webfinger link titles pruned: #{data.inspect}, ignoring") end end |