Module: HALPresenter::Curies

Included in:
HALPresenter, HALPresenter::Collection::Properties
Defined in:
lib/hal_presenter/curies.rb

Defined Under Namespace

Classes: Curie

Instance Method Summary collapse

Instance Method Details

#curie(rel, value = nil, embed_depth: nil, &block) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/hal_presenter/curies.rb', line 18

def curie(rel, value = nil, embed_depth: nil, &block)
  if value.nil? && !block_given?
    raise 'curie must be called with non nil value or be given a block'
  end
  @_curies ||= __init_curies
  @_curies = @_curies.reject { |curie| curie.name == rel }
  @_curies << Curie.new(rel, value, embed_depth: embed_depth, &block)
end