class I18n::Processes::Scanners::Results::Occurrence
The occurrence of some key in a file.
@note This is a value type. Equality and hash code are determined from the attributes.
Attributes
@return [String, nil] the value of the `default:` argument of the translate call.
@return [String] the line of the occurrence, excluding the last LF or CRLF.
@return [Integer] line number of the occurrence, counting from 1.
@return [Integer] position of the start of the occurrence in the line, counting from 1.
@return [String] source path relative to the current working directory.
@return [Integer] count of characters in the file before the occurrence.
@return [String, nil] the raw key (for relative keys and references)
Public Class Methods
@param path [String] @param pos [Integer] @param line_num
[Integer] @param line_pos
[Integer] @param line [String] @param raw_key
[String, nil] @param default_arg
[String, nil] rubocop:disable Metrics/ParameterLists
# File lib/i18n/processes/scanners/results/occurrence.rb, line 39 def initialize(path:, pos:, line_num:, line_pos:, line:, raw_key: nil, default_arg: nil) @path = path @pos = pos @line_num = line_num @line_pos = line_pos @line = line @raw_key = raw_key @default_arg = default_arg end
Public Instance Methods
# File lib/i18n/processes/scanners/results/occurrence.rb, line 54 def ==(other) other.path == @path && other.pos == @pos && other.line_num == @line_num && other.line == @line && other.raw_key == @raw_key && other.default_arg == @default_arg end
# File lib/i18n/processes/scanners/results/occurrence.rb, line 59 def eql?(other) self == other end
# File lib/i18n/processes/scanners/results/occurrence.rb, line 63 def hash [@path, @pos, @line_num, @line_pos, @line, @default_arg].hash end
rubocop:enable Metrics/ParameterLists
# File lib/i18n/processes/scanners/results/occurrence.rb, line 50 def inspect "Occurrence(#{@path}:#{@line_num}:#{@line_pos}:#{@pos}:#{@raw_key}:#{@default_arg})" end