Class: Linkify::Match
- Inherits:
-
Object
- Object
- Linkify::Match
- Defined in:
- lib/linkify-it-rb/index.rb
Overview
Match result. Single element of array, returned by [[LinkifyIt#match]]
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#lastIndex ⇒ Object
Returns the value of attribute lastIndex.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#text ⇒ Object
Returns the value of attribute text.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.createMatch(obj, shift) ⇒ Object
——————————————————————————.
Instance Method Summary collapse
-
#initialize(obj, shift) ⇒ Match
constructor
A new instance of Match.
Constructor Details
#initialize(obj, shift) ⇒ Match
Returns a new instance of Match.
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/linkify-it-rb/index.rb', line 228 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 |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
226 227 228 |
# File 'lib/linkify-it-rb/index.rb', line 226 def index @index end |
#lastIndex ⇒ Object
Returns the value of attribute lastIndex.
226 227 228 |
# File 'lib/linkify-it-rb/index.rb', line 226 def lastIndex @lastIndex end |
#raw ⇒ Object
Returns the value of attribute raw.
226 227 228 |
# File 'lib/linkify-it-rb/index.rb', line 226 def raw @raw end |
#schema ⇒ Object
Returns the value of attribute schema.
226 227 228 |
# File 'lib/linkify-it-rb/index.rb', line 226 def schema @schema end |
#text ⇒ Object
Returns the value of attribute text.
226 227 228 |
# File 'lib/linkify-it-rb/index.rb', line 226 def text @text end |
#url ⇒ Object
Returns the value of attribute url.
226 227 228 |
# File 'lib/linkify-it-rb/index.rb', line 226 def url @url end |
Class Method Details
.createMatch(obj, shift) ⇒ Object
265 266 267 268 269 |
# File 'lib/linkify-it-rb/index.rb', line 265 def self.createMatch(obj, shift) match = Match.new(obj, shift) obj.__compiled__[match.schema][:normalize].call(match, obj) return match end |