Sha256: 759e5d6434449bfa167b501cc54ce39ba32c5828af8e8077955c433fdb3b7949
Contents?: true
Size: 754 Bytes
Versions: 10
Compression:
Stored size: 754 Bytes
Contents
# frozen_string_literal: true class MatchData # @return [Array<String>] # def pre_match_lines @pre_match_lines ||= pre_match.split(/\r?\n/) end # @return [Array<String>] # def post_match_lines @post_match_lines ||= post_match.split(/\r?\n/) end # @return [Fixnum] # def line_number n = pre_match_lines.length n += 1 if n.zero? # it can't be zero, this happens only when the match is at the beginning of file or string n end # @return [Fixnum] # def line_index pre_match_lines.length - 1 end # @return [String] # def matched_line (pre_match_lines.last || '') + matched_string + (post_match_lines.first || '') end # @return [String] # def matched_string self[0] end end
Version data entries
10 entries across 10 versions & 1 rubygems