lib/ionian/extension/io.rb in ionian-0.5.0 vs lib/ionian/extension/io.rb in ionian-0.6.0
- old
+ new
@@ -49,10 +49,16 @@
def expression=(exp)
@ionian_expression = exp
@ionian_expression = Regexp.new "(.*?)#{expression}" if exp.is_a? String
end
+ # Read all data in the buffer.
+ # An alternative to using #readpartial with a large length.
+ def read_all
+ readpartial 0xFFFF
+ end
+
# Read matched data from the buffer.
# This method SHOULD NOT be used if #run_match is used.
#
# Passes matches to the block (do |match|). If there are multiple
# matches, the block is called multiple times.
@@ -70,10 +76,10 @@
#
# kwargs:
# timeout: Timeout in seconds IO::select will block.
# skip_select: Skip over the IO::select statement. Use if you
# are calling IO::select ahead of this method.
- # build_methods: Build method accessors from named captures.
+ # build_methods: Build accessor methods from named capture groups.
# Enabled by default.
def read_match(**kwargs, &block)
timeout = kwargs.fetch :timeout, @ionian_timeout
skip_select = kwargs.fetch :skip_select, @ionian_skip_select
build_methods = kwargs.fetch :build_methods, @ionian_build_methods
\ No newline at end of file