Results for: "max_by"

No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available

Sorts self in place using a set of keys generated by mapping the values in self through the given block.

If no block is given, an Enumerator is returned instead.

Returns the length of str in bytes.

"\x80\u3042".bytesize  #=> 4
"hello".bytesize       #=> 5

Byte Reference—If passed a single Fixnum, returns a substring of one byte at that position. If passed two Fixnum objects, returns a substring starting at the offset given by the first, and a length given by the second. If given a Range, a substring containing bytes at offsets given by the range is returned. In all three cases, if an offset is negative, it is counted from the end of str. Returns nil if the initial offset falls outside the string, the length is negative, or the beginning of the range is greater than the end. The encoding of the resulted string keeps original encoding.

"hello".byteslice(1)     #=> "e"
"hello".byteslice(-1)    #=> "o"
"hello".byteslice(1, 2)  #=> "el"
"\x80\u3042".byteslice(1, 3) #=> "\u3042"
"\x03\u3042\xff".byteslice(1..3) #=> "\u3042"

Returns an array of bytes in str. This is a shorthand for str.each_byte.to_a.

If a block is given, which is a deprecated form, works the same as each_byte.

Passes each byte in str to the given block, or returns an enumerator if no block is given.

"hello".each_byte {|c| print c, ' ' }

produces:

104 101 108 108 111

Calls the given block once for each byte (0..255) in ios, passing the byte as an argument. The stream must be opened for reading or an IOError will be raised.

If no block is given, an enumerator is returned instead.

f = File.new("testfile")
checksum = 0
f.each_byte {|x| checksum ^= x }   #=> #<File:testfile>
checksum                           #=> 12

This is a deprecated alias for each_byte.

See IO#each_byte.

This is a deprecated alias for each_byte.

Scans one byte and returns it. This method is not multibyte character sensitive. See also: getch.

s = StringScanner.new('ab')
s.get_byte         # => "a"
s.get_byte         # => "b"
s.get_byte         # => nil

$KCODE = 'EUC'
s = StringScanner.new("\244\242")
s.get_byte         # => "\244"
s.get_byte         # => "\242"
s.get_byte         # => nil

Returns a random binary string containing size bytes.

random_string = Random.new.bytes(10) # => "\xD7:R\xAB?\x83\xCE\xFAkO"
random_string.size                   # => 10
No documentation available

bn.num_bytes => integer

Creates a new Socket::Option object which contains a byte as data.

p Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1)
#=> #<Socket::Option: INET SOCKET KEEPALIVE 1>

Returns the data in sockopt as an byte.

sockopt = Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1)
p sockopt.byte => 1

See Zlib::GzipReader documentation for a description.

This is a deprecated alias for each_byte.

Returns the total size in bytes of all the messages on the POP server.

This doesn’t yet handle encodings

Search took: 3ms  ·  Total Results: 607