def strfcoord(formatstr)
      h = full_hash

      DIRECTIVES.reduce(formatstr) do |memo, (from, to)|
        memo.gsub(from) do
          to = to.call(Regexp.last_match) if to.is_a?(Proc)
          res = to % h
          res, carrymin = guard_seconds(to, res)
          h[carrymin] += 1 if carrymin
          res
        end
      end
    end
def strfcoord(formatstr)
      h = full_hash

      DIRECTIVES.reduce(formatstr) do |memo, (from, to)|
        memo.gsub(from) do
          to = to.call(Regexp.last_match) if to.is_a?(Proc)
          res = to % h
          res, carrymin = guard_seconds(to, res)
          h[carrymin] += 1 if carrymin
          res
        end
      end
    end
Formats coordinates according to directives in +formatstr+.

 Each directive starts with +%+ and can contain some modifiers before
 its name.

 Acceptable modifiers:
 - unsigned integers: none;
 - signed integers: <tt>+</tt> for mandatory sign printing;
 - floats: same as integers and number of digits modifier, like
   <tt>.03</tt>.

 List of directives:

 %lat :: Full latitude, floating point, signed
 %latds :: Latitude degrees, integer, signed
 %latd :: Latitude degrees, integer, unsigned
 %latm :: Latitude minutes, integer, unsigned
 %lats :: Latitude seconds, floating point, unsigned
 %lath :: Latitude hemisphere, "N" or "S"
 %lng :: Full longitude, floating point, signed
 %lngds :: Longitude degrees, integer, signed
 %lngd :: Longitude degrees, integer, unsigned
 %lngm :: Longitude minutes, integer, unsigned
 %lngs :: Longitude seconds, floating point, unsigned
 %lngh :: Longitude hemisphere, "E" or "W"

 Examples:

    g = Geo::Coord.new(50.004444, 36.231389)
    g.strfcoord('%+lat, %+lng')
    # => "+50.004444, +36.231389"
    g.strfcoord("%latd°%latm'%lath -- %lngd°%lngm'%lngh")
    # => "50°0'N -- 36°13'E"

 +strfcoord+ handles seconds rounding implicitly:

    pos = Geo::Coord.new(0.033333, 91.333333)
    pos.lats # => 0.599988e2
    pos.strfcoord('%latd %latm %.05lats') # => "0 1 59.99880"
    pos.strfcoord('%latd %latm %lats')  # => "0 2 0"