Module: HALPresenter::Profile

Includes:
SuperInit
Included in:
HALPresenter
Defined in:
lib/hal_presenter/profile.rb

Instance Method Summary collapse

Instance Method Details

#profile(value = Property::NO_VALUE, **kwargs, &block) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/hal_presenter/profile.rb', line 7

def profile(value = Property::NO_VALUE, **kwargs, &block)
  if value.nil? && !block_given?
    raise 'profile must be called with non nil value or be given a block'
  end

  kwargs[:context] ||= self
  @__semantic_profile = Property.new('profile', value, **kwargs, &block)
end

#semantic_profile(object = nil, **kwargs) ⇒ Object



16
17
18
19
# File 'lib/hal_presenter/profile.rb', line 16

def semantic_profile(object = nil, **kwargs)
  init_profile
  @__semantic_profile&.value(object, kwargs)
end