Module: LinkedRails::Model::Iri::ClassMethods
- Defined in:
- lib/linked_rails/model/iri.rb
Instance Method Summary collapse
- #iri ⇒ Object
- #iri_namespace ⇒ Object
- #iri_template ⇒ Object
- #iri_value ⇒ Object
- #linked_rails_module? ⇒ Boolean
Instance Method Details
#iri ⇒ Object
94 95 96 |
# File 'lib/linked_rails/model/iri.rb', line 94 def iri @iri ||= iri_namespace[iri_value] if iri_namespace end |
#iri_namespace ⇒ Object
98 99 100 101 102 103 |
# File 'lib/linked_rails/model/iri.rb', line 98 def iri_namespace return if self == ApplicationRecord superclass.try(:iri_namespace) || (linked_rails_module? ? Vocab.ontola : LinkedRails.app_vocab) end |
#iri_template ⇒ Object
109 110 111 |
# File 'lib/linked_rails/model/iri.rb', line 109 def iri_template @iri_template ||= URITemplate.new("/#{route_key}{/id}{#fragment}") end |
#iri_value ⇒ Object
105 106 107 |
# File 'lib/linked_rails/model/iri.rb', line 105 def iri_value linked_rails_module? ? name.demodulize : name end |
#linked_rails_module? ⇒ Boolean
113 114 115 |
# File 'lib/linked_rails/model/iri.rb', line 113 def linked_rails_module? (Rails.version < '6' ? parents : module_parents).include?(LinkedRails) end |