class Linkify::Match

Match result. Single element of array, returned by [[LinkifyIt#match]]

Attributes

index[RW]
lastIndex[RW]
raw[RW]
schema[RW]
text[RW]
url[RW]

Public Class Methods

createMatch(obj, shift) click to toggle source
# File lib/linkify-it-rb/index.rb, line 263
def self.createMatch(obj, shift)
  match = Match.new(obj, shift)
  obj.__compiled__[match.schema][:normalize].call(match, obj)
  return match
end
new(obj, shift) click to toggle source
# File lib/linkify-it-rb/index.rb, line 226
def initialize(obj, shift)
  start = obj.__index__
  endt  = obj.__last_index__
  text  = obj.__text_cache__.slice(start...endt)

  # Match#schema -> String
  #
  # Prefix (protocol) for matched string.
  @schema    = obj.__schema__.downcase

  # Match#index -> Number
  #
  # First position of matched string.
  @index     = start + shift

  # Match#lastIndex -> Number
  #
  # Next position after matched string.
  @lastIndex = endt + shift

  # Match#raw -> String
  #
  # Matched string.
  @raw       = text

  # Match#text -> String
  #
  # Notmalized text of matched string.
  @text      = text

  # Match#url -> String
  #
  # Normalized url of matched string.
  @url       = text
end