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
92 93 94 |
# File 'lib/linked_rails/model/iri.rb', line 92 def iri @iri ||= iri_namespace[iri_value] if iri_namespace end |
#iri_namespace ⇒ Object
96 97 98 99 100 101 |
# File 'lib/linked_rails/model/iri.rb', line 96 def iri_namespace return if self == ApplicationRecord superclass.try(:iri_namespace) || (linked_rails_module? ? Vocab.ontola : Vocab.app) end |
#iri_template ⇒ Object
107 108 109 |
# File 'lib/linked_rails/model/iri.rb', line 107 def iri_template @iri_template ||= LinkedRails::URITemplate.new("/#{route_key}{/id}{#fragment}") end |
#iri_value ⇒ Object
103 104 105 |
# File 'lib/linked_rails/model/iri.rb', line 103 def iri_value linked_rails_module? ? name.demodulize : name end |
#linked_rails_module? ⇒ Boolean
111 112 113 |
# File 'lib/linked_rails/model/iri.rb', line 111 def linked_rails_module? (Rails.version < '6' ? parents : module_parents).include?(LinkedRails) end |