lib/address_extractor.rb
# Pass it a block that recieves 2 parameters:
#   address hash
#   matched address string ($&)
# Whatever your block returns will be used for the substition.
# Returns new string with substition applied to first identified address.
# If no address found, returns same string unaltered.
Pass it a block that recieves 2 parameters:
address hash
matched address string ($&)
Whatever your block returns will be used for the substition.
Returns new string with substition applied to first identified address.
If no address found, returns same string unaltered.
Pass it a block that recieves 2 parameters : address hash matched address string ( $& ) Whatever your block returns will be used for the substition . Returns new string with substition applied to first identified address . If no address found returns same string unaltered .
def replace_first_address(string)
      hash = first_address(string)
      string.sub(ADDRESS_PATTERN) do |match|
        yield(hash, $&)
      end
    end
def replace_first_address ( string ) hash = first_address ( string ) string . sub ( ADDRESS_PATTERN ) do | match | yield ( hash , $& ) end end
Pass it a block that recieves 2 parameters:
address hash
matched address string ($&)
Whatever your block returns will be used for the substition.
Pass it a block that recieves 2 parameters : address hash matched address string ( $& ) Whatever your block returns will be used for the substition .
string
<not_specific>