Alias for Regexp.new
Same as sym.to_s.length
.
Returns clean pathname of self
with consecutive slashes and useless dots removed. The filesystem is not accessed.
If consider_symlink
is true
, then a more conservative algorithm is used to avoid breaking symbolic linkages. This may retain more ..
entries than absolutely necessary, but without accessing the filesystem, this can’t be avoided.
See Pathname#realpath
.
Removes a file or directory, using File.unlink
if self
is a file, or Dir.unlink
as necessary.
Tokenizes the Ruby program and returns an array of an array, which is formatted like [[lineno, column], type, token, state]
.
require 'ripper' require 'pp' pp Ripper.lex("def m(a) nil end") #=> [[[1, 0], :on_kw, "def", Ripper::EXPR_FNAME ], [[1, 3], :on_sp, " ", Ripper::EXPR_FNAME ], [[1, 4], :on_ident, "m", Ripper::EXPR_ENDFN ], [[1, 5], :on_lparen, "(", Ripper::EXPR_LABEL | Ripper::EXPR_BEG], [[1, 6], :on_ident, "a", Ripper::EXPR_ARG ], [[1, 7], :on_rparen, ")", Ripper::EXPR_ENDFN ], [[1, 8], :on_sp, " ", Ripper::EXPR_BEG ], [[1, 9], :on_kw, "nil", Ripper::EXPR_END ], [[1, 12], :on_sp, " ", Ripper::EXPR_END ], [[1, 13], :on_kw, "end", Ripper::EXPR_END ]]
Return current parsing filename.
Returns the number of keys in the database.
Deletes the key-value pair corresponding to the given key
. If the key
exists, the deleted value will be returned, otherwise nil
.
If a block is provided, the deleted key
and value
will be passed to the block as arguments. If the key
does not exist in the database, the value will be nil
.
Deletes all data from the database.
This is a deprecated alias for each_codepoint
.
Returns nil
. Just for compatibility to IO
.
Returns the size of the buffer string.
By overriding Object#methods
, WIN32OLE
might work well with did_you_mean gem. This is experimental.
require 'win32ole' dict = WIN32OLE.new('Scripting.Dictionary') dict.Ade('a', 1) #=> Did you mean? Add
Sets current codepage. The WIN32OLE.codepage
is initialized according to Encoding.default_internal
. If Encoding.default_internal
is nil then WIN32OLE.codepage
is initialized according to Encoding.default_external
.
WIN32OLE.codepage = WIN32OLE::CP_UTF8 WIN32OLE.codepage = 65001
Returns current locale id (lcid). The default locale is WIN32OLE::LOCALE_SYSTEM_DEFAULT
.
lcid = WIN32OLE.locale
Sets current locale id (lcid).
WIN32OLE.locale = 1033 # set locale English(U.S) obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY)
sets event handler object. If handler object has onXXX method according to XXX event, then onXXX method is called when XXX event occurs.
If handler object has method_missing and there is no method according to the event, then method_missing called and 1-st argument is event name.
If handler object has onXXX method and there is block defined by WIN32OLE_EVENT#on_event
(‘XXX’){}, then block is executed but handler object method is not called when XXX event occurs.
class Handler def onStatusTextChange(text) puts "StatusTextChanged" end def onPropertyChange(prop) puts "PropertyChanged" end def method_missing(ev, *arg) puts "other event #{ev}" end end handler = Handler.new ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE_EVENT.new(ie) ev.on_event("StatusTextChange") {|*args| puts "this block executed." puts "handler.onStatusTextChange method is not called." } ev.handler = handler
returns handler object.
Returns true if the method is public.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') method = WIN32OLE_METHOD.new(tobj, 'Add') puts method.visible? # => true