Sha256: fa89ae68ff4ff83a6d55a60870ee48f3c18b4e035ce330d35e73cd26cc77ea90
Contents?: true
Size: 813 Bytes
Versions: 74
Compression:
Stored size: 813 Bytes
Contents
require 'gherkin/native' module Gherkin module Formatter class Argument native_impl('gherkin') attr_reader :byte_offset, :val def initialize(byte_offset, val) @byte_offset, @val = byte_offset, val end def self.format(string, argument_format, arguments) arguments ||= [] s = string.dup offset = past_offset = 0 arguments.each do |arg| next if arg.byte_offset.nil? || arg.byte_offset < past_offset replacement = argument_format.format_argument(arg.val) s[arg.byte_offset + offset, arg.val.length] = replacement offset += replacement.unpack("U*").length - arg.val.unpack("U*").length past_offset = arg.byte_offset + arg.val.length end s end end end end
Version data entries
74 entries across 74 versions & 1 rubygems