Class: Regexp
Overview
# Add file name, line number, line to captures_hash captures_hash = $~.pre_match.split(ānā).last captures_hash = $~.pre_match.count(ānā) + 1 captures_hash = $&
Instance Method Summary collapse
Instance Method Details
#gsub_format(input_str, format_str, context: {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/regexp.rb', line 29 def gsub_format(input_str, format_str, context: {}) input_str.gsub(self) do format( format_str, context.merge($~.names.each_with_object({}) do |name, hash| hash[name.to_sym] = $~[name] end) ) end end |