Class: Shaf::Serializer
- Inherits:
-
Object
- Object
- Shaf::Serializer
- Extended by:
- HALPresenter, UriHelper
- Defined in:
- lib/shaf/serializer.rb
Overview
A base class used for serializing objects into a HAL representations.
Class Attribute Summary collapse
-
.default_curie_prefix ⇒ Object
readonly
Returns the value of attribute default_curie_prefix.
Class Method Summary collapse
-
.profile(name, curie_prefix: :doc) ⇒ Object
Creates a link with rel profile and href pointing to the corresponding profile.
Methods included from UriHelper
Methods included from UriHelperMethods
add_path_helpers, eval_method, path_helpers, #path_helpers, path_helpers_for, register, remove_all
Class Attribute Details
.default_curie_prefix ⇒ Object (readonly)
Returns the value of attribute default_curie_prefix.
12 13 14 |
# File 'lib/shaf/serializer.rb', line 12 def default_curie_prefix @default_curie_prefix end |
Class Method Details
.profile(name, curie_prefix: :doc) ⇒ Object
Creates a link with rel profile and href pointing to the corresponding profile. It also adds a Curie link.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/shaf/serializer.rb', line 18 def profile(name, curie_prefix: :doc) profile = Profiles.find name super { profile&.urn || profile_uri(name) } link :profile do profile_uri(name) end curie curie_prefix do doc_curie_uri(name) end @default_curie_prefix = curie_prefix.to_sym end |