Module: JSONAPI::Serializable::Resource::Links::DSL
- Defined in:
- lib/jsonapi/serializable/resource/links.rb
Overview
DSL methods for declaring resource links.
Instance Method Summary collapse
- #inherited(klass) ⇒ Object
-
#link(name, &block) ⇒ Object
Declare a link for this resource.
Instance Method Details
#inherited(klass) ⇒ Object
35 36 37 38 |
# File 'lib/jsonapi/serializable/resource/links.rb', line 35 def inherited(klass) super klass.link_blocks = link_blocks.dup end |
#link(name, &block) ⇒ Object
Declare a link for this resource. The properties of the link are set
by providing a block in which the DSL methods of
+JSONAPI::Serializable::Link+ are called, or the value of the link
is returned directly.
60 61 62 |
# File 'lib/jsonapi/serializable/resource/links.rb', line 60 def link(name, &block) link_blocks[name] = block end |