Corrects path
(usually returned by ‘Gem::URI.parse().path` on Windows), that comes with a leading slash.
Defines a public singleton method in the receiver. The method parameter can be a Proc
, a Method
or an UnboundMethod
object. If a block is specified, it is used as the method body. If a block or a method has parameters, they’re used as method parameters.
class A class << self def class_name to_s end end end A.define_singleton_method(:who_am_i) do "I am: #{class_name}" end A.who_am_i # ==> "I am: A" guy = "Bob" guy.define_singleton_method(:hello) { "#{self}: Hello there!" } guy.hello #=> "Bob: Hello there!" chris = "Chris" chris.define_singleton_method(:greet) {|greeting| "#{greeting}, I'm Chris!" } chris.greet("Hi") #=> "Hi, I'm Chris!"
Returns a list of the public instance methods defined in mod. If the optional parameter is false
, the methods of any ancestors are not included.
Returns a list of the protected instance methods defined in mod. If the optional parameter is false
, the methods of any ancestors are not included.
Returns a list of the undefined instance methods defined in mod. The undefined methods of any ancestors are not included.
Similar to instance_method, searches public method only.
Returns true
if the named public method is defined by mod. If inherit is set, the lookup will also search mod’s ancestors. String
arguments are converted to symbols.
module A def method1() end end class B protected def method2() end end class C < B include A def method3() end end A.method_defined? :method1 #=> true C.public_method_defined? "method1" #=> true C.public_method_defined? "method1", true #=> true C.public_method_defined? "method1", false #=> true C.public_method_defined? "method2" #=> false C.method_defined? "method2" #=> true
Returns true
if the named protected method is defined mod. If inherit is set, the lookup will also search mod’s ancestors. String
arguments are converted to symbols.
module A def method1() end end class B protected def method2() end end class C < B include A def method3() end end A.method_defined? :method1 #=> true C.protected_method_defined? "method1" #=> false C.protected_method_defined? "method2" #=> true C.protected_method_defined? "method2", true #=> true C.protected_method_defined? "method2", false #=> false C.method_defined? "method2" #=> true
Makes a list of existing class methods public.
String
arguments are converted to symbols. An Array
of Symbols and/or Strings is also accepted.
Returns the array of WIN32OLE::Method
object . The element of the array is property (gettable) of WIN32OLE
object.
excel = WIN32OLE.new('Excel.Application') properties = excel.ole_get_methods
Returns the array of WIN32OLE::Method
object . The element of the array is property (settable) of WIN32OLE
object.
excel = WIN32OLE.new('Excel.Application') properties = excel.ole_put_methods
Returns the array of WIN32OLE::Method
object . The element of the array is property (settable) of WIN32OLE
object.
excel = WIN32OLE.new('Excel.Application') properties = excel.ole_func_methods
Returns WIN32OLE::Method
object corresponding with method specified by 1st argument.
excel = WIN32OLE.new('Excel.Application') method = excel.ole_method_help('Quit')
Invoked as a callback whenever a singleton method is added to the receiver.
module Chatty def Chatty.singleton_method_added(id) puts "Adding #{id.id2name}" end def self.one() end def two() end def Chatty.three() end end
produces:
Adding singleton_method_added Adding one Adding three
Invoked as a callback whenever a singleton method is removed from the receiver.
module Chatty def Chatty.singleton_method_removed(id) puts "Removing #{id.id2name}" end def self.one() end def two() end def Chatty.three() end class << self remove_method :three remove_method :one end end
produces:
Removing three Removing one
Invoked as a callback whenever a singleton method is undefined in the receiver.
module Chatty def Chatty.singleton_method_undefined(id) puts "Undefining #{id.id2name}" end def Chatty.one() end class << self undef_method(:one) end end
produces:
Undefining one
Returns information about object moved in the most recent GC compaction.
The returned hash
contains the following keys:
Hash
containing the type of the object as the key and the number of objects of that type that were considered for movement.
Hash
containing the type of the object as the key and the number of objects of that type that were actually moved.
Hash
containing the type of the object as the key and the number of objects of that type that were increased in size.
Hash
containing the type of the object as the key and the number of objects of that type that were decreased in size.
Some objects can’t be moved (due to pinning) so these numbers can be used to calculate compaction efficiency.
Enable to measure GC time. You can get the result with GC.stat(:time)
. Note that GC time measurement can cause some performance overhead.
Return measure_total_time
flag (default: true
). Note that measurement can affect the application performance.
Glob pattern for require-able plugin suffixes.
Suffixes for dynamic library require-able paths.
Mirror the Prism.parse_file_comments
API by using the serialization API. This uses native strings instead of Ruby strings because it allows us to use mmap when it is available.