Class: Ubi::Memoria::Site
Overview
A site, url and title?
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
- .key ⇒ Object
-
.regex(_hint) ⇒ Object
Regex only for *.tld %r?)+)(?:/|.) (?:??)[a-zA-Z0-9-._?,'/\+&%$#=~]+.
Instance Method Summary collapse
-
#format ⇒ Object
Prefix http:// if there isn’t one defined.
Methods inherited from Base
==, extract_text, inherited, #initialize, name, parse, parse!, #parser, plural, #to_s
Constructor Details
This class inherits a constructor from Ubi::Memoria::Base
Class Method Details
.key ⇒ Object
35 36 37 |
# File 'lib/ubi/memorias/site.rb', line 35 def key :site end |
.regex(_hint) ⇒ Object
Regex only for *.tld %r?)+)(?:/|.) (?:??)[a-zA-Z0-9-._?,'/\+&%$#=~]+
%rhref="a-zA-Z0-9\-\.">https?://)?(?:www.)?+.[a-zA-Z]{2,3}
((?:https://)|(?:http://)|(?:www.))?(. [a-zA-Z]{2,3}(?:??)[a-zA-Z0-9-._?,'/\&%$#=~]+)
www.regexr.com/3bkne /([(https?)://(www.)?a-zA-Z0-9:@%._+~#=]2,256.[a-z]2,6b (?:[-a-zA-Z0-9@:%_+.~#?&//?=]*))/
without @
27 28 29 30 31 32 33 |
# File 'lib/ubi/memorias/site.rb', line 27 def regex(_hint) %r{ ([(https?)://(www\.)?a-zA-Z0-9:%\._\+~#=]{2,256} \.[a-z]{2,6}\b (?:[-a-zA-Z0-9@:%_\+.~#?&//?=]*)) }x end |
Instance Method Details
#format ⇒ Object
Prefix http:// if there isn’t one defined
7 8 9 |
# File 'lib/ubi/memorias/site.rb', line 7 def format text =~ /^http/ ? text : "http://#{text}" end |