Extracts addr, ifindex and spec_dst from IP_PKTINFO ancillary data.
IP_PKTINFO is not standard.
Supported platform: GNU/Linux
addr = Addrinfo.ip("127.0.0.1") ifindex = 0 spec_dest = Addrinfo.ip("127.0.0.1") ancdata = Socket::AncillaryData.ip_pktinfo(addr, ifindex, spec_dest) p ancdata.ip_pktinfo #=> [#<Addrinfo: 127.0.0.1>, 0, #<Addrinfo: 127.0.0.1>]
Returns new ancillary data for IPV6_PKTINFO.
IPV6_PKTINFO is defined by RFC 3542.
addr = Addrinfo.ip("::1") ifindex = 0 p Socket::AncillaryData.ipv6_pktinfo(addr, ifindex) #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO ::1 ifindex:0>
Extracts addr and ifindex from IPV6_PKTINFO ancillary data.
IPV6_PKTINFO is defined by RFC 3542.
addr = Addrinfo.ip("::1") ifindex = 0 ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex) p ancdata.ipv6_pktinfo #=> [#<Addrinfo: ::1>, 0]
Replace %w+% into the environment value of what is contained between the %‘s This method is used for REG_EXPAND_SZ.
For detail, see expandEnvironmentStrings Win32 API.
Defines the callback event. If argument is omitted, this method defines the callback of all events. If you want to modify reference argument in callback, return hash in callback. If you want to return value to OLE server as result of callback use ‘return’ or :return.
ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE::Event.new(ie) ev.on_event("NavigateComplete") {|url| puts url} ev.on_event() {|ev, *args| puts "#{ev} fired"} ev.on_event("BeforeNavigate2") {|*args| # ... # set true to BeforeNavigate reference argument `Cancel'. # Cancel is 7-th argument of BeforeNavigate, # so you can use 6 as key of hash instead of 'Cancel'. # The argument is counted from 0. # The hash key of 0 means first argument.) {:Cancel => true} # or {'Cancel' => true} or {6 => true} } ev.on_event(event_name) {|*args| {:return => 1, :xxx => yyy} }
Duplicates the deflate stream.
Same as IO
.
Make an internal copy of the source buffer. Updates to the copy will not affect the source buffer.
source = IO::Buffer.for("Hello World") # => # #<IO::Buffer 0x00007fd598466830+11 EXTERNAL READONLY SLICE> # 0x00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 Hello World buffer = source.dup # => # #<IO::Buffer 0x0000558cbec03320+11 INTERNAL> # 0x00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 Hello World
Like Net::HTTP.get
, but returns a Net::HTTPResponse
object instead of the body string.
Sets the read timeout, in seconds, for self
to integer sec
; the initial value is 60.
Argument sec
must be a non-negative numeric value:
http = Net::HTTP.new(hostname) http.read_timeout # => 60 http.get('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true> http.read_timeout = 0 http.get('/todos/1') # Raises Net::ReadTimeout.
Sets the write timeout, in seconds, for self
to integer sec
; the initial value is 60.
Argument sec
must be a non-negative numeric value:
_uri = uri.dup _uri.path = '/posts' body = 'bar' * 200000 data = <<EOF {"title": "foo", "body": "#{body}", "userId": "1"} EOF headers = {'content-type': 'application/json'} http = Net::HTTP.new(hostname) http.write_timeout # => 60 http.post(_uri.path, data, headers) # => #<Net::HTTPCreated 201 Created readbody=true> http.write_timeout = 0 http.post(_uri.path, data, headers) # Raises Net::WriteTimeout.
Executes a request which uses a representation and returns its body.
Return the character offset for the given byte offset.
Return the column number in characters for the given byte offset.
Return the character offset for the given byte offset.
Return the column number in characters for the given byte offset.