Class: Card::Content::Chunk::HostUri

Inherits:
Uri show all
Defined in:
mod/content/lib/card/content/chunk/uri.rb

Constant Summary collapse

GENERIC =
"aero|biz|com|coop|edu|gov|info|int|mil|" \
"museum|name|net|org".freeze
COUNTRY =
"ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|" \
"bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cf|cd|cg|" \
"ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|" \
"ec|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|fx|ga|gb|gd|ge|gf|gh|" \
"gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|" \
"il|in|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|" \
"kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|" \
"mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|" \
"no|np|nr|nt|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pt|pw|py|" \
"qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|" \
"st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|" \
"tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|" \
"za|zm|zr|zw|" \
"eu".freeze
TLDS =

a country -efm These are needed otherwise HOST will match almost anything

"(?:#{GENERIC}|#{COUNTRY})".freeze
PREPEND_STR =

TLDS = “(?:#GENERIC)”

"http://".freeze
HOST =
"(?:[a-zA-Z\\d](?:[-a-zA-Z\\d]*[a-zA-Z\\d])?\\.)+#{TLDS}".freeze

Constants inherited from Uri

Uri::REJECTED_PREFIX_RE, Uri::SCHEMES

Instance Attribute Summary

Attributes inherited from Uri

#link_text, #uri

Attributes inherited from Abstract

#process_chunk, #text

Instance Method Summary collapse

Methods inherited from Uri

context_ok?, full_match, #interpret

Methods inherited from Abstract

#as_json, #burn_after_reading, #burn_read, #card, context_ok?, #format, full_match, full_re, #initialize, #inspect, #interpret, #reference_code, #result, #to_s

Constructor Details

This class inherits a constructor from Card::Content::Chunk::Abstract

Instance Method Details

#process_textObject

removes the prepended string from the unchanged match text



144
145
146
# File 'mod/content/lib/card/content/chunk/uri.rb', line 144

def process_text
  @text = @text.sub(%r{^http://}, "")
end