Class: LinkedRails::Widget
- Inherits:
-
Object
- Object
- LinkedRails::Widget
- Includes:
- ActiveModel::Model, Model
- Defined in:
- app/models/linked_rails/widget.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#resources ⇒ Object
writeonly
Sets the attribute resources.
- #size ⇒ Object
-
#topology ⇒ Object
Returns the value of attribute topology.
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_opts, #rdf_type, #reload, #root_relative_iri, #route_fragment
Methods included from Model::Enhancements
Methods included from Model::Dirty
#previous_changes_by_predicate, #previously_changed_relations
Methods included from Model::Collections
#collection_for, #parent_collections
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
9 10 11 |
# File 'app/models/linked_rails/widget.rb', line 9 def parent @parent end |
#resources=(value) ⇒ Object (writeonly)
Sets the attribute resources
8 9 10 |
# File 'app/models/linked_rails/widget.rb', line 8 def resources=(value) @resources = value end |
#size ⇒ Object
30 31 32 |
# File 'app/models/linked_rails/widget.rb', line 30 def size @size || 1 end |
#topology ⇒ Object
Returns the value of attribute topology.
9 10 11 |
# File 'app/models/linked_rails/widget.rb', line 9 def topology @topology end |
Class Method Details
.iri ⇒ Object
46 47 48 |
# File 'app/models/linked_rails/widget.rb', line 46 def iri Vocab.ontola[:Widget] end |
.preview_includes ⇒ Object
50 51 52 |
# File 'app/models/linked_rails/widget.rb', line 50 def preview_includes %i[resource_sequence property_shapes] end |
Instance Method Details
#iri(_opts = {}) ⇒ Object
11 12 13 |
# File 'app/models/linked_rails/widget.rb', line 11 def iri(_opts = {}) @iri ||= RDF::Node.new end |
#property_shapes ⇒ Object
15 16 17 18 19 |
# File 'app/models/linked_rails/widget.rb', line 15 def property_shapes resource_sequence @property_shapes || {} end |
#resource_sequence ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/models/linked_rails/widget.rb', line 21 def resource_sequence @resource_sequence ||= LinkedRails::Sequence.new( @resources.map { |iri, predicate| predicate.present? ? property_shape(iri, predicate).iri : RDF::URI(iri) }, parent: self, scope: false ) end |