113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/bootic_client/entity.rb', line 113
def rels
@rels ||= (
links = attrs.fetch('_links', {})
links.each_with_object({}) do |(rel,rel_attrs),memo|
if rel =~ CURIE_EXP
_, curie_namespace, rel = rel.split(CURIE_EXP)
if curie = curies.find{|c| c['name'] == curie_namespace}
rel_attrs['docs'] = Relation.expand(curie['href'], rel: rel)
end
end
if rel != CURIES_REL
rel_attrs['name'] = rel
memo[rel.to_sym] = Relation.new(rel_attrs, client)
end
end
)
end
|