Returns whether or not the struct of type type
contains member
. If it does not, or the struct type can’t be found, then false is returned. You may optionally specify additional headers
in which to look for the struct (in addition to the common header files).
If found, a macro is passed as a preprocessor constant to the compiler using the type name and the member name, in uppercase, prepended with HAVE_
.
For example, if have_struct_member('struct foo', 'bar')
returned true, then the HAVE_STRUCT_FOO_BAR
preprocessor macro would be passed to the compiler.
HAVE_ST_BAR
is also defined for backward compatibility.
Returns strongly connected components as an array of arrays of nodes. The array is sorted from children to parents. Each elements of the array represents a strongly connected component.
class G include TSort def initialize(g) @g = g end def tsort_each_child(n, &b) @g[n].each(&b) end def tsort_each_node(&b) @g.each_key(&b) end end graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}) p graph.strongly_connected_components #=> [[4], [2], [3], [1]] graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}) p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
Returns strongly connected components as an array of arrays of nodes. The array is sorted from children to parents. Each elements of the array represents a strongly connected component.
The graph is represented by each_node and each_child. each_node should have call
method which yields for each node in the graph. each_child should have call
method which takes a node argument and yields for each child node.
g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]} each_node = lambda {|&b| g.each_key(&b) } each_child = lambda {|n, &b| g[n].each(&b) } p TSort.strongly_connected_components(each_node, each_child) #=> [[4], [2], [3], [1]] g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]} each_node = lambda {|&b| g.each_key(&b) } each_child = lambda {|n, &b| g[n].each(&b) } p TSort.strongly_connected_components(each_node, each_child) #=> [[4], [2, 3], [1]]
ptr.to_str => string ptr.to_str(len) => string
Returns the pointer contents as a string.
When called with no arguments, this method will return the contents with the length of this pointer’s size
.
When called with len
, a string of len
bytes will be returned.
See to_s
Called when the YAML
stream ends
Returns true if the stream is finished.
It returns recorded script lines if it is available. The script lines are not limited to the iseq range, but are entire lines of the source file.
Note that this is an API for ruby internal use, debugging, and research. Do not use this for any other purpose. The compatibility is not guaranteed.
Sets the maximum number of times to retry an idempotent request in case of Net::ReadTimeout, IOError
, EOFError
, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError
, Timeout::Error
. The initial value is 1.
Argument retries
must be a non-negative numeric value:
http = Net::HTTP.new(hostname) http.max_retries = 2 # => 2 http.max_retries # => 2
Sends a POST request to the server; forms the response into a Net::HTTPResponse
object.
The request is based on the Net::HTTP::Post
object created from string path
, string data
, and initial headers hash initheader
.
With no block given, returns the response object:
http = Net::HTTP.new(hostname) http.post('/todos', 'xyzzy') # => #<Net::HTTPCreated 201 Created readbody=true>
With a block given, calls the block with the response body and returns the response object:
http.post('/todos', 'xyzzy') do |res| p res end # => #<Net::HTTPCreated 201 Created readbody=true>
Output:
"{\n \"xyzzy\": \"\",\n \"id\": 201\n}"
Sets the body stream for the request:
req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST> req.body_stream # => nil require 'stringio' req.body_stream = StringIO.new('xyzzy') # => #<StringIO:0x0000027d1e5affa8> req.body_stream # => #<StringIO:0x0000027d1e5affa8>
Returns the full path for an HTTP
request, as required by Net::HTTP::Get
.
If the URI
contains a query, the full path is URI#path + ‘?’ + URI#query. Otherwise, the path is simply URI#path.
Example:
uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true') uri.request_uri # => "/foo/bar?test=true"
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, binary_operator_loc
: Location
, value: Prism::node, binary_operator
: Symbol
, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, binary_operator_loc
: Location
, value: Prism::node, binary_operator
: Symbol
, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, binary_operator_loc
: Location
, value: Prism::node, binary_operator
: Symbol
, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}
def deconstruct_keys
: (Array keys) -> { name: Symbol
, name_loc
: Location
, operator_loc
: Location
, value: Prism::node, location: Location
}