Module: Roar::Hypermedia::ClassMethods
- Defined in:
- lib/roar/hypermedia.rb
Instance Method Summary collapse
-
#link(options, &block) ⇒ Object
Declares a hypermedia link in the document.
Instance Method Details
#link(options, &block) ⇒ Object
Declares a hypermedia link in the document.
Example:
link :self do
"http://orders/#{id}"
end
The block is executed in instance context, so you may call properties or other accessors. Note that you’re free to put decider logic into #link blocks, too.
88 89 90 91 92 93 94 95 96 |
# File 'lib/roar/hypermedia.rb', line 88 def link(, &block) heritage.record(:link, , &block) links_dfn = create_links_definition! # this assures the links are rendered at the right position. = {:rel => } unless .is_a?(::Hash) links_dfn.link_configs << [, block] end |