Returns running OLE Automation object or WIN32OLE
object from moniker. 1st argument should be OLE program id or class id or moniker.
WIN32OLE.connect('Excel.Application') # => WIN32OLE object which represents running Excel.
Returns the type library version.
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') puts tlib.version #-> "1.3"
Returns revision information for the erb.rb module.
Version
Returns the smallest number than or equal to int
in decimal digits (default 0 digits).
Precision may be negative. Returns a floating point number when ndigits
is positive, self
for zero, and truncate up for negative.
1.truncate #=> 1 1.truncate(2) #=> 1.0 15.truncate(-1) #=> 10
This method injects an instance variable unconverted_fields
into row
and an accessor method for row
called unconverted_fields(). The variable is set to the contents of fields
.
Task
description for the clobber rdoc task or its renamed equivalent
Task
description for the rdoc task or its renamed equivalent
Task
description for the rerdoc task or its renamed description
Establishes proc on thr as the handler for tracing, or disables tracing if the parameter is nil
.
Adds proc as a handler for tracing.
Establishes proc as the handler for tracing, or disables tracing if the parameter is nil
.
Note: this method is obsolete, please use TracePoint
instead.
proc takes up to six parameters:
an event name
a filename
a line number
an object id
a binding
the name of a class
proc is invoked whenever an event occurs.
Events are:
c-call
call a C-language routine
c-return
return from a C-language routine
call
call a Ruby method
class
start a class or module definition
end
finish a class or module definition
line
execute code on a new line
raise
raise an exception
return
return from a Ruby method
Tracing is disabled within the context of proc.
class Test def test a = 1 b = 2 end end set_trace_func proc { |event, file, line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname } t = Test.new t.test line prog.rb:11 false c-call prog.rb:11 new Class c-call prog.rb:11 initialize Object c-return prog.rb:11 initialize Object c-return prog.rb:11 new Class line prog.rb:12 false call prog.rb:2 test Test line prog.rb:3 test Test line prog.rb:4 test Test return prog.rb:4 test Test
Returns the class for the given object
.
class A def foo ObjectSpace::trace_object_allocations do obj = Object.new p "#{ObjectSpace::allocation_class_path(obj)}" end end end A.new.foo #=> "Class"
See ::trace_object_allocations
for more information and examples.
Content: [ String text ]
schedule a command
Writes out text, substituting special characters beforehand. out
A String, IO
, or any other object supporting <<( String ) input
the text to substitute and the write out
z=utf8.unpack("U*") ascOut="" z.each{|r| if r < 0x100 ascOut.concat(r.chr) else ascOut.concat(sprintf("&#x%x;", r)) end } puts ascOut
Reads text, substituting entities
Iterates over strongly connected component in the subgraph reachable from node.
Return value is unspecified.
each_strongly_connected_component_from
doesn’t call tsort_each_node
.
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=>[]}) graph.each_strongly_connected_component_from(2) {|scc| p scc } #=> [4] # [2] graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}) graph.each_strongly_connected_component_from(2) {|scc| p scc } #=> [4] # [2, 3]
Iterates over strongly connected components in a graph. The graph is represented by node and each_child.
node is the first node. each_child should have call
method which takes a node argument and yields for each child node.
Return value is unspecified.
TSort.each_strongly_connected_component_from is a class method and it doesn’t need a class to represent a graph which includes TSort
.
graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]} each_child = lambda {|n, &b| graph[n].each(&b) } TSort.each_strongly_connected_component_from(1, each_child) {|scc| p scc } #=> [4] # [2, 3] # [1]