Class: Hypermicrodata::Serializer::Hal
- Defined in:
- lib/hypermicrodata/serializer/hal.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Hypermicrodata::Serializer::Base
Instance Method Details
#serialize ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hypermicrodata/serializer/hal.rb', line 4 def serialize items = @document.items if items.length == 1 hal_resource = item_to_resource(items.first, @location) else hal_resource = Halibut::Core::Resource.new(@location) items.each do |item| = item_to_resource(item) item.type.each do |type| hal_resource.(type, ) end end end hal_resource.add_link('profile', @profile_path) if @profile_path hal_resource.to_hash end |