Module: HALPresenter::Attributes
- Includes:
- SuperInit
- Included in:
- HALPresenter, Collection::Properties
- Defined in:
- lib/hal_presenter/attributes.rb
Instance Method Summary collapse
Instance Method Details
#attribute(name, value = Property::NO_VALUE, **kwargs, &block) ⇒ Object
8 9 10 11 12 13 14 |
# 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 |