Returns array of WIN32OLE_METHOD
objects which represent OLE method defined in OLE type library.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') methods = tobj.ole_methods.collect{|m| m.name } # => ['Activate', 'Copy', 'Delete',....]
Invoked by Ruby when obj is sent a message it cannot handle. symbol is the symbol for the method called, and args are any arguments that were passed to it. By default, the interpreter raises an error when this method is called. However, it is possible to override the method to provide more dynamic behavior. If it is decided that a particular method should not be handled, then super should be called, so that ancestors can pick up the missing method. The example below creates a class Roman
, which responds to methods with names consisting of roman numerals, returning the corresponding integer values.
class Roman def roman_to_int(str) # ... end def method_missing(methId) str = methId.id2name roman_to_int(str) end end r = Roman.new r.iv #=> 4 r.xxiii #=> 23 r.mm #=> 2000
Stores the indicated separators for later use.
If auto-discovery was requested for @row_sep
, this method will read ahead in the @io
and try to find one. ARGF
, STDIN
, STDOUT
, STDERR
and any stream open for output only with a default @row_sep
of $INPUT_RECORD_SEPARATOR
($/
).
This method also establishes the quoting rules used for CSV
output.
Handles the magic of delegation through _getobj_.
Returns the methods available to this delegate object as the union of this object’s and _getobj_ public methods.
Returns the methods available to this delegate object as the union of this object’s and _getobj_ protected methods.
Define methodname as instance method of mod from compiled Ruby source.
example:
filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml erb = ERB.new(File.read(filename)) erb.def_method(MyClass, 'render(arg1, arg2)', filename) print MyClass.new.render('foo', 123)
Returns true if the ipaddr is an IPv4-compatible IPv6 address.
Returns a new ipaddr built by converting the native IPv4 address into an IPv4-compatible IPv6 address.
Returns a Method
of superclass which would be called when super is used or nil if there is no method on superclass.
Returns a Method
of superclass which would be called when super is used or nil if there is no method on superclass.
Return the name at the definition of the method being called
Returns garbage collector generation for the given object
.
class B include ObjectSpace def foo trace_object_allocations do obj = Object.new p "Generation is #{allocation_generation(obj)}" end end end B.new.foo #=> "Generation is 3"
See ::trace_object_allocations
for more information and examples.
Parse a YAML string in yaml
. Returns the Psych::Nodes::Stream
. This method can handle multiple YAML documents contained in yaml
. filename
is used in the exception message if a Psych::SyntaxError
is raised.
If a block is given, a Psych::Nodes::Document
node will be yielded to the block as it’s being parsed.
Raises a Psych::SyntaxError
when a YAML syntax error is detected.
Example:
Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00> Psych.parse_stream("--- a\n--- b") do |node| node # => #<Psych::Nodes::Document:0x00> end begin Psych.parse_stream("--- `", "file.txt") rescue Psych::SyntaxError => ex ex.file # => 'file.txt' ex.message # => "(file.txt): found character that cannot start any token" end
See Psych::Nodes
for more information about YAML AST.
Returns true if the contents of a stream a
and b
are identical.
Returns true if the contents of a stream a
and b
are identical.
Returns an Array of method names which have the option opt
.
p FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
Returns whether or not the given framework
can be found on your system. If found, a macro is passed as a preprocessor constant to the compiler using the framework name, in uppercase, prepended with HAVE_FRAMEWORK_
.
For example, if have_framework('Ruby')
returned true, then the HAVE_FRAMEWORK_RUBY
preprocessor macro would be passed to the compiler.
If fw
is a pair of the framework name and its header file name that header file is checked, instead of the normally used header file which is named same as the framework.
Glob pattern for require-able path suffixes.
Constructs proper parameters from arguments