collect_concat

enum.collect_concat { |obj| block } â arrayenum.collect_concat â an_enumerator Instance Public methods Returns a new array with the concatenated results of running block once for every element in enum. If no block is given, an enumerator is returned instead. [1, 2, 3, 4].flat_map { |e| [e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4] [[1, 2], [3, 4]].flat_map { |e| e + [100] } #=> [1, 2, 100, 3, 4, 100]

cos

cos(z) Class Public methods returns the cosine of z, where z is given in radians cos!

tv_sec

tv_sec() Instance Public methods Alias for: to_i

[]

thr[sym] â obj or nil Instance Public methods Attribute ReferenceâReturns the value of a fiber-local variable (current thread's root fiber if not explicitely inside a Fiber), using either a symbol or a string name. If the specified variable does not exist, returns nil. [ Thread.new { Thread.current["name"] = "A" }, Thread.new { Thread.current[:name] = "B" }, Thread.new { Thread.current["name"] = "C" } ].each do |th| th.join puts "#{th.inspect}: #{th[:name]}" end prod

id

id() Instance Public methods

extract_subdomain

extract_subdomain(host, tld_length = @@tld_length) Class Public methods

new

new(*args) Class Public methods

accept_loop

accept_loop(*sockets) Class Public methods yield socket and client address for each a connection accepted via given sockets. The arguments are a list of sockets. The individual argument should be a socket or an array of sockets. This method yields the block sequentially. It means that the next connection is not accepted until the block returns. So concurrent mechanism, thread for example, should be used to service multiple clients at a time.

new

new(*args) Class Public methods

sysread

ios.sysread(maxlen[, outbuf]) â string Instance Public methods Reads maxlen bytes from ios using a low-level read and returns them as a string. Do not mix with other methods that read from ios or you may get unpredictable results. If the optional outbuf argument is present, it must reference a String, which will receive the data. The outbuf will contain only the received data after the method call even if it is not empty at the beginning. Raises SystemCallError on error and EO