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