Cross Reference:
xref
: /
ontohub
/
app
/
models
/
entity
/
readability.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
readability.rb revision 4ca034f85658e9b2ec5526968cb7f42c0b30c066
module
Entity
::
Readability
extend
ActiveSupport
::
Concern
included
do
before_save
:
set_display_name_and_iri
,
if
: :
name_is_iri_and_in_text
end
def
set_display_name_and_iri
iri
=
URI.parse
(
name_is_iri_and_in_text
)
self.display
_name
=
iri.fragment
||
iri.path.split
(
"/"
)
.
last
self.iri
=
iri.to
_s
end
def
name_is_iri_and_in_text
self.text
[
self.name
][
URI
::
regexp
(
ALLOWED_URI_SCHEMES
)
]
rescue
""
end
end