lib/phonelib/phone_analyzer_helper.rb in phonelib-0.9.3 vs lib/phonelib/phone_analyzer_helper.rb in phonelib-0.10.1

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Phonelib # @private helper methods for analyser module PhoneAnalyzerHelper private @@ -50,10 +52,10 @@ Phonelib.phone_data[country][Core::COUNTRY_CODE] end # caches regular expression, reusing it for later lookups def cr(regexp) - Phonelib.phone_regexp_cache[regexp] ||= Regexp.new(regexp).freeze + Phonelib.phone_regexp_cache[regexp] ||= Regexp.new(block_given? ? yield(regexp) : regexp).freeze end # defines whether country can have double country prefix in number def country_can_dp?(country) Phonelib.phone_data[country] &&