class ShafClient::Curie
Attributes
name[R]
Public Class Methods
from(data)
click to toggle source
# File lib/shaf_client/curie.rb, line 9 def self.from(data) if data.is_a? Array data.map do |d| new(name: data['name'], href: d['href'], templated: d['templated']) end else new(name: data['name'], href: data['href'], templated: data['templated']) end end
new(name:, href:, templated: nil)
click to toggle source
# File lib/shaf_client/curie.rb, line 19 def initialize(name:, href:, templated: nil) @name = name @href = href @templated = !!templated end
Public Instance Methods
resolve_templated(**args)
click to toggle source
Calls superclass method
# File lib/shaf_client/curie.rb, line 25 def resolve_templated(**args) args[:rel] &&= args[:rel].to_s.sub(/#{name}:/, '') super(**args) end
to_h()
click to toggle source
Calls superclass method
# File lib/shaf_client/curie.rb, line 30 def to_h {name: name}.merge(super) end