module Roar::JSON::HAL::Links::ClassMethods
Public Instance Methods
curies(&block)
click to toggle source
Add a CURIEs link section as defined in
curies do
[{:name => :doc, :href => "//docs/{rel}", :templated => true} ]
end
# File lib/roar/json/hal.rb, line 188 def curies(&block) links(:curies, &block) end
links(options, &block)
click to toggle source
Use this to define link arrays. It accepts the shared rel attribute and an array of options per link object.
links :self do [{:lang => "en", :href => "http://en.hit"}, {:lang => "de", :href => "http://de.hit"}] end
# File lib/roar/json/hal.rb, line 174 def links(options, &block) options = {:rel => options} if options.is_a?(Symbol) || options.is_a?(String) options[:array] = true link(options, &block) end
links_definition_options()
click to toggle source
# File lib/roar/json/hal.rb, line 158 def links_definition_options { # collection: false, :as => :_links, decorator: Links::Representer, instance: ->(*) { Array.new }, # defined in InstanceMethods as this is executed in represented context. :exec_context => :decorator, } end