Class: LinkedRails::Manifest

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, Model
Defined in:
app/models/linked_rails/manifest.rb

Constant Summary

Constants included from LinkedRails::Model::Collections

LinkedRails::Model::Collections::COLLECTION_CUSTOMIZABLE_OPTIONS, LinkedRails::Model::Collections::COLLECTION_OPTIONS, LinkedRails::Model::Collections::COLLECTION_STATIC_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#build_child

Methods included from LinkedRails::Model::Singularable

#root_relative_iri, #root_relative_singular_iri, #singular_iri, #singular_iri?, #singular_iri_opts, #singular_iri_template, #singular_resource?

Methods included from LinkedRails::Model::Serialization

#preview_includes, #show_includes

Methods included from LinkedRails::Model::Menuable

#menu, #menu_list, #menus

Methods included from LinkedRails::Model::IRI

#anonymous_iri, #anonymous_iri?, #iri, #iri_elements, #iri_opts, #rdf_type, #reload, #root_relative_iri, #route_fragment

Methods included from LinkedRails::Model::Enhancements

#enhanced_with?

Methods included from LinkedRails::Model::Dirty

#previously_changed_relations

Methods included from LinkedRails::Model::Collections

#collection_for, #collection_iri, #collection_options_for, #collection_root_relative_iri, #parent_collections

Methods included from LinkedRails::Model::Actionable

#action, #action_list, #action_triples, #actions, #collection_actions, #favorite_actions

Class Method Details

.destroy(iri) ⇒ Object



163
164
165
# File 'app/models/linked_rails/manifest.rb', line 163

def destroy(iri)
  Storage.hdel(:persistent, :manifest, URL.as_href(iri))
end

.move(from, to) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'app/models/linked_rails/manifest.rb', line 167

def move(from, to)
  Storage.hset(
    :persistent,
    :redirect_prefix,
    URL.as_href(from) => URL.as_href(to)
  )

  data = Storage.hget(:persistent, :manifest, URL.as_href(from))

  Storage.hset(:persistent, :manifest, URL.as_href(to), data) if data

  destroy(from)
end

Instance Method Details

#saveObject



8
9
10
11
12
13
14
# File 'app/models/linked_rails/manifest.rb', line 8

def save
  Storage.hset(
    :persistent,
    :manifest,
    URL.as_href(LinkedRails.iri) => web_manifest.to_json
  )
end

#web_manifestObject



16
17
18
19
20
21
# File 'app/models/linked_rails/manifest.rb', line 16

def web_manifest
  web_manifest_base.merge(
    ontola: web_manifest_ontola_section,
    serviceworker: web_manifest_sw_section
  )
end