import ruby-scanf

scanf is an implementation of the C function scanf(3), modified as
necessary for Ruby compatibility.

The methods provided are String#scanf, IO#scanf, and Kernel#scanf.
Kernel#scanf is a wrapper around STDIN.scanf. IO#scanf can be used on
any IO stream, including file handles and sockets. scanf can be called
either with or without a block.

Scanf scans an input string or stream according to a format, as
described below in Conversions, and returns an array of matches between
the format and the input. The format is defined in a string, and is
similar (though not identical) to the formats used in Kernel#printf and
Kernel#sprintf.

The format may contain conversion specifiers, which tell scanf what form
(type) each particular matched substring should be converted to (e.g.,
decimal integer, floating point number, literal string, etc.) The
matches and conversions take place from left to right, and the
conversions themselves are returned as an array.

The format string may also contain characters other than those in the
conversion specifiers. Whitespace (blanks, tabs, or newlines) in the
format string matches any amount of whitespace, including none, in the
input. Everything else matches only itself.

Scanning stops, and scanf returns, when any input character fails to
match the specifications in the format string, or when input is
exhausted, or when everything in the format string has been matched. All
matches found up to the stopping point are returned in the return array
(or yielded to the block, if a block was given).
This commit is contained in:
sebastia 2023-01-20 20:42:33 +00:00
parent dfce0dd7ac
commit b2dc429106
4 changed files with 52 additions and 0 deletions

15
devel/ruby-scanf/Makefile Normal file
View File

@ -0,0 +1,15 @@
COMMENT = implementation of the C function scanf
DISTNAME = scanf-1.0.0
CATEGORIES = devel
HOMEPAGE = https://github.com/ruby/scanf
MAINTAINER = Sebastian Reitenbach <sebastia@openbsd.org>
# BSD
PERMIT_PACKAGE = Yes
MODULES = lang/ruby
CONFIGURE_STYLE = ruby gem
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (scanf-1.0.0.gem) = Uz239+Wsr+oaFF1sUynO9melj7y31kN5qAj/EZnuGwA=
SIZE (scanf-1.0.0.gem) = 12288

View File

@ -0,0 +1,30 @@
scanf is an implementation of the C function scanf(3), modified as
necessary for Ruby compatibility.
The methods provided are String#scanf, IO#scanf, and Kernel#scanf.
Kernel#scanf is a wrapper around STDIN.scanf. IO#scanf can be used on
any IO stream, including file handles and sockets. scanf can be called
either with or without a block.
Scanf scans an input string or stream according to a format, as
described below in Conversions, and returns an array of matches between
the format and the input. The format is defined in a string, and is
similar (though not identical) to the formats used in Kernel#printf and
Kernel#sprintf.
The format may contain conversion specifiers, which tell scanf what form
(type) each particular matched substring should be converted to (e.g.,
decimal integer, floating point number, literal string, etc.) The
matches and conversions take place from left to right, and the
conversions themselves are returned as an array.
The format string may also contain characters other than those in the
conversion specifiers. Whitespace (blanks, tabs, or newlines) in the
format string matches any amount of whitespace, including none, in the
input. Everything else matches only itself.
Scanning stops, and scanf returns, when any input character fails to
match the specifications in the format string, or when input is
exhausted, or when everything in the format string has been matched. All
matches found up to the stopping point are returned in the return array
(or yielded to the block, if a block was given).

View File

@ -0,0 +1,5 @@
${GEM_LIB}/cache/${DISTNAME}.gem
${GEM_LIB}/gems/${DISTNAME}/
${GEM_LIB}/gems/${DISTNAME}/lib/
${GEM_LIB}/gems/${DISTNAME}/lib/scanf.rb
${GEM_LIB}/specifications/${DISTNAME}.gemspec