Method: Scanf::FormatSpecifier#match

Defined in:
lib/scanf.rb

#match(str) ⇒ Object



456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/scanf.rb', line 456

def match(str)
  @matched = false
  s = str.dup
  s.sub!(/\A\s+/,'') unless count_space?
  res = to_re.match(s)
  if res
    @conversion = send(@handler, res[1])
    @matched_string = @conversion.to_s
    @matched = true
  end
  res
end