Class: LinkedRails::EntryPoint

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#build_child, #singular_resource?

Methods included from Model::Serialization

#preview_includes, #show_includes

Methods included from Model::Iri

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

Methods included from Model::Enhancements

#enhanced_with?

Methods included from Model::Dirty

#previous_changes_by_predicate, #previously_changed_relations

Methods included from Model::Collections

#collection_for, #parent_collections

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



8
9
10
# File 'app/models/linked_rails/entry_point.rb', line 8

def parent
  @parent
end

#urlObject



33
34
35
# File 'app/models/linked_rails/entry_point.rb', line 33

def url
  @url || parent.url
end

Class Method Details

.iriObject



48
49
50
# File 'app/models/linked_rails/entry_point.rb', line 48

def iri
  Vocab.schema.EntryPoint
end

Instance Method Details

#action_bodyObject



13
14
15
16
17
# File 'app/models/linked_rails/entry_point.rb', line 13

def action_body
  return form if form.is_a?(RDF::URI)

  form&.form_iri
end

#as_json(_opts = {}) ⇒ Object



19
20
21
# File 'app/models/linked_rails/entry_point.rb', line 19

def as_json(_opts = {})
  {}
end

#iri_templateObject



23
24
25
# File 'app/models/linked_rails/entry_point.rb', line 23

def iri_template
  @iri_template ||= iri_template_with_fragment(URITemplate.new(parent.root_relative_iri.to_s), :EntryPoint)
end

#labelObject



27
28
29
30
31
# File 'app/models/linked_rails/entry_point.rb', line 27

def label
  var = parent.submit_label
  value = var.respond_to?(:call) ? parent.list.instance_exec(&var) : var
  value || label_fallback
end