module HALPresenter::Attributes

Public Instance Methods

attribute(name, value = Property::NO_VALUE, **kwargs, &block) click to toggle source
# File lib/hal_presenter/attributes.rb, line 8
def attribute(name, value = Property::NO_VALUE, **kwargs, &block)
  kwargs[:context] ||= self
  attributes.delete_if { |attr| attr.name == name }
  Property.new(name, value, **kwargs, &block).tap do |attr|
    attributes << attr
  end
end

Protected Instance Methods

attributes() click to toggle source
# File lib/hal_presenter/attributes.rb, line 18
def attributes
  @__attributes ||= __init_from_superclass(:attributes)
end