repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
|---|---|---|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/blt/graph7a.rb
|
<reponame>arnab0073/idea
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
file = File.join(File.dirname(File.expand_path(__FILE__)),
'images', 'buckskin.gif')
bgTexture = TkPhotoImage.new(:file=>file)
TkOption.add('*Graph.Tile', bgTexture)
TkOption.add('*Label.Tile', bgTexture)
TkOption.add('*Frame.Tile', bgTexture)
TkOption.add('*Htext.Tile', bgTexture)
TkOption.add('*TileOffset', 0)
TkOption.add('*HighlightThickness', 0)
TkOption.add('*Element.ScaleSybols', false)
TkOption.add('*Element.Smooth', :linear)
TkOption.add('*activeLine.Color', 'yellow4')
TkOption.add('*activeLine.Fill', 'yellow')
TkOption.add('*activeLine.LineWidth', 0)
TkOption.add('*Element.Pixels', 3)
TkOption.add('*Graph.halo', '7i')
if Tk.root.winfo_screenvisual != 'staticgray'
TkOption.add('*print.background', 'yellow')
TkOption.add('*quit.background', 'red')
end
length = 250000
graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
graph.yaxis_configure(:title=>'Y Axis Label')
graph.legend_configure(:activerelief=>:sunken, :background=>'')
Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
v_x = Tk::BLT::Vector.new(length)
v_y = Tk::BLT::Vector.new(length)
v_x.expr("random(#{v_x})")
v_y.expr("random(#{v_y})")
v_x.sort(v_y)
plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
:color=>'green4', :fill=>'green2',
:linewidth=>0, :outlinewidth=>1,
:pixels=>4, :label=>'plot',
:xdata=>v_x, :ydata=>v_y)
Tk.root.minsize(0, 0)
#graph.zoom_stack
#graph.crosshairs
#graph.active_legend
#graph.closest_point
Tk::BLT.zoom_stack(graph)
Tk::BLT.crosshairs(graph)
Tk::BLT.active_legend(graph)
Tk::BLT.closest_point(graph)
Tk::BLT::Busy.hold(graph)
Tk.update
Tk::BLT::Busy.release(graph)
Tk.mainloop
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tk/listbox.rb
|
#
# tk/listbox.rb : treat listbox widget
#
require 'tk'
require 'tk/itemconfig'
require 'tk/scrollable'
require 'tk/txtwin_abst'
module TkListItemConfig
include TkItemConfigMethod
def __item_listval_optkeys(id)
[]
end
private :__item_listval_optkeys
end
class Tk::Listbox<TkTextWin
include TkListItemConfig
include Scrollable
TkCommandNames = ['listbox'.freeze].freeze
WidgetClassName = 'Listbox'.freeze
WidgetClassNames[WidgetClassName] ||= self
#def create_self(keys)
# if keys and keys != None
# tk_call_without_enc('listbox', @path, *hash_kv(keys, true))
# else
# tk_call_without_enc('listbox', @path)
# end
#end
#private :create_self
def __tkvariable_optkeys
super() << 'listvariable'
end
private :__tkvariable_optkeys
def tagid(id)
#id.to_s
_get_eval_string(id)
end
def activate(y)
tk_send_without_enc('activate', y)
self
end
def curselection
list(tk_send_without_enc('curselection'))
end
def get(first, last=nil)
if last
# tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
tk_split_simplelist(tk_send_without_enc('get', first, last), false, true)
else
_fromUTF8(tk_send_without_enc('get', first))
end
end
def nearest(y)
tk_send_without_enc('nearest', y).to_i
end
def size
tk_send_without_enc('size').to_i
end
def selection_anchor(index)
tk_send_without_enc('selection', 'anchor', index)
self
end
def selection_clear(first, last=None)
tk_send_without_enc('selection', 'clear', first, last)
self
end
def selection_includes(index)
bool(tk_send_without_enc('selection', 'includes', index))
end
def selection_set(first, last=None)
tk_send_without_enc('selection', 'set', first, last)
self
end
def index(idx)
tk_send_without_enc('index', idx).to_i
end
def value
get('0', 'end')
end
def value= (vals)
unless vals.kind_of?(Array)
fail ArgumentError, 'an Array is expected'
end
tk_send_without_enc('delete', '0', 'end')
tk_send_without_enc('insert', '0',
*(vals.collect{|v| _get_eval_enc_str(v)}))
vals
end
def clear
tk_send_without_enc('delete', '0', 'end')
self
end
alias erase clear
=begin
def itemcget(index, key)
case key.to_s
when 'text', 'label', 'show'
_fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}"))
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_send('itemcget', index, "-#{key}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index,
'-font')))
unless fnt.kind_of?(TkFont)
fnt = tagfontobj(index, fnt)
end
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
# obsolete; just for compatibility
fnt.kanji_font
else
fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}")))
end
end
def itemconfigure(index, key, val=None)
if key.kind_of? Hash
if (key['font'] || key[:font] ||
key['kanjifont'] || key[:kanjifont] ||
key['latinfont'] || key[:latinfont] ||
key['asciifont'] || key[:asciifont] )
tagfont_configure(index, _symbolkey2str(key))
else
tk_send_without_enc('itemconfigure', index, *hash_kv(key, true))
end
else
if (key == 'font' || key == :font ||
key == 'kanjifont' || key == :kanjifont ||
key == 'latinfont' || key == :latinfont ||
key == 'asciifont' || key == :asciifont )
if val == None
tagfontobj(index)
else
tagfont_configure(index, {key=>val})
end
else
tk_call('itemconfigure', index, "-#{key}", val)
end
end
self
end
def itemconfiginfo(index, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
case key.to_s
when 'text', 'label', 'show'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
when 'font', 'kanjifont'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
conf[4] = tagfont_configinfo(index, conf[4])
else
conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
end
conf[0] = conf[0][1..-1]
conf
else
ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).collect{|conflist|
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show'
else
if conf[3]
if conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
if conf[4]
if conf[4].index('{')
conf[4] = tk_split_list(conf[4])
else
conf[4] = tk_tcl2ruby(conf[4])
end
end
end
conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
conf
}
fontconf = ret.assoc('font')
if fontconf
ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
fontconf[4] = tagfont_configinfo(index, fontconf[4])
ret.push(fontconf)
else
ret
end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if key
case key.to_s
when 'text', 'label', 'show'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
when 'font', 'kanjifont'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
conf[4] = tagfont_configinfo(index, conf[4])
else
conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
end
key = conf.shift[1..-1]
{ key => conf }
else
ret = {}
tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).each{|conflist|
conf = tk_split_simplelist(conflist)
key = conf.shift[1..-1]
case key
when 'text', 'label', 'show'
else
if conf[2]
if conf[2].index('{')
conf[2] = tk_split_list(conf[2])
else
conf[2] = tk_tcl2ruby(conf[2])
end
end
if conf[3]
if conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
end
if conf.size == 1
ret[key] = conf[0][1..-1] # alias info
else
ret[key] = conf
end
}
fontconf = ret['font']
if fontconf
ret.delete('font')
ret.delete('kanjifont')
fontconf[3] = tagfont_configinfo(index, fontconf[3])
ret['font'] = fontconf
end
ret
end
end
end
def current_itemconfiginfo(index, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
conf = itemconfiginfo(index, key)
{conf[0] => conf[4]}
else
ret = {}
itemconfiginfo(index).each{|conf|
ret[conf[0]] = conf[4] if conf.size > 2
}
ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
itemconfiginfo(index, key).each{|k, conf|
ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
end
=end
end
#TkListbox = Tk::Listbox unless Object.const_defined? :TkListbox
#Tk.__set_toplevel_aliases__(:Tk, Tk::Listbox, :TkListbox)
Tk.__set_loaded_toplevel_aliases__('tk/listbox.rb', :Tk, Tk::Listbox,
:TkListbox)
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/rubygems/test_gem_commands_open_command.rb
|
<gh_stars>1-10
# frozen_string_literal: false
require 'rubygems/test_case'
require 'rubygems/commands/open_command'
class TestGemCommandsOpenCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::OpenCommand.new
end
def gem name
spec = quick_gem name do |gem|
gem.files = %W[lib/#{name}.rb Rakefile]
end
write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
write_file File.join(*%W[gems #{spec.full_name} Rakefile])
spec
end
def test_execute
@cmd.options[:args] = %w[foo]
@cmd.options[:editor] = "#{Gem.ruby} -e0 --"
spec = gem 'foo'
mock = MiniTest::Mock.new
mock.expect(:call, true, [spec.full_gem_path])
Dir.stub(:chdir, mock) do
use_ui @ui do
@cmd.execute
end
end
assert mock.verify
assert_equal "", @ui.error
end
def test_execute_bad_gem
@cmd.options[:args] = %w[foo]
assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
end
assert_match %r|Unable to find gem 'foo'|, @ui.output
assert_equal "", @ui.error
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
|
<filename>.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
#
# tkextlib/tcllib/tablelist_tlie.rb
# by <NAME> (<EMAIL>)
#
# * Part of tcllib extension
# * A multi-column listbox
require 'tk'
require 'tkextlib/tcllib.rb'
# TkPackage.require('tablelist_tile', '4.2')
TkPackage.require('tablelist_tile')
unless defined? Tk::Tcllib::Tablelist_usingTile
Tk::Tcllib::Tablelist_usingTile = true
end
requrie 'tkextlib/tcllib/tablelist_core'
module Tk
module Tcllib
class Tablelist
# commands related to tile Themems
def self.set_theme(theme)
Tk.tk_call('::tablelist::setTheme', theme)
end
def self.get_current_theme
Tk.tk_call('::tablelist::getCurrentTheme')
end
def self.get_theme_list
TkComm.simplelist(Tk.tk_call('::tablelist::getThemes'))
end
def self.set_theme_defaults
Tk.tk_call('::tablelist::setThemeDefaults')
end
end
Tablelist_Tile = Tablelist
TableList_Tile = Tablelist
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/sample/delegate.rb
|
require 'delegate'
class ExtArray<DelegateClass(Array)
def initialize()
super([])
end
end
ary = ExtArray.new
p ary.class
ary.push 25
p ary
ary.push 42
ary.each {|x| p x}
foo = Object.new
def foo.test
25
end
def foo.iter
yield self
end
def foo.error
raise 'this is OK'
end
foo2 = SimpleDelegator.new(foo)
p foo2
foo2.instance_eval{print "foo\n"}
p foo.test == foo2.test # => true
p foo2.iter{[55,true]} # => true
foo2.error # raise error!
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkbrowse.rb
|
<gh_stars>1-10
#!/usr/bin/env ruby
#
# This script generates a directory browser, which lists the working
# directory and allows you to open files or subdirectories by
# double-clicking.
# Create a scrollbar on the right side of the main window and a listbox
# on the left side.
require "tkscrollbox"
# The procedure below is invoked to open a browser on a given file; if the
# file is a directory then another instance of this program is invoked; if
# the file is a regular file then the Mx editor is invoked to display
# the file.
$dirlist = {}
def browsedir (dir)
if $dirlist.key? dir
$dirlist[dir]
else
top = if $dirlist.size > 0 then TkToplevel.new else nil end
list = TkScrollbox.new(top) {
relief 'raised'
width 20
height 20
setgrid 'yes'
pack
}
list.insert 'end', *`ls #{dir}`.split
# Set up bindings for the browser.
list.focus
list.bind "Control-q", proc{exit}
list.bind "Control-c", proc{exit}
list.bind "Control-p", proc{
print "selection <", TkSelection.get, ">\n"
}
list.bind "Double-Button-1", proc{
for i in TkSelection.get.split
print "clicked ", i, "\n"
browse dir, i
end
}
$dirlist[dir] = list
end
end
def browse (dir, file)
file="#{dir}/#{file}"
if File.directory? file
browsedir(file)
else
if File.file? file
if ENV['EDITOR']
system format("%s %s&", ENV['EDITOR'], file)
else
system "xedit #{file}&"
end
else
STDERR.print "\"#{file}\" isn't a directory or regular file"
end
end
end
# Fill the listbox with a list of all the files in the directory (run
# the "ls" command to get that information).
if ARGV.length>0
dir = ARGV[0]
else
dir="."
end
browsedir(dir)
Tk.mainloop
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/demos-en/tkencoding.rb
|
# -*- ruby -*-
#
# tkencoding.rb
# written by <EMAIL>
class TclTkIp
alias __eval _eval
alias __invoke _invoke
private :__eval
private :__invoke
attr_accessor :encoding
def _eval(cmd)
if( @encoding )
_fromUTF8(__eval(_toUTF8(cmd,@encoding)),@encoding)
else
__eval(cmd)
end
end
def _invoke(*cmds)
if( @encoding )
cmds = cmds.collect{|cmd| _toUTF8(cmd,@encoding)}
_fromUTF8(__invoke(*cmds),@encoding)
else
__invoke(*cmds)
end
end
end
module Tk
INTERP = TkCore::INTERP
def encoding=(name)
INTERP.encoding = name
end
def encoding
INTERP.encoding
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/sdbm/extconf.rb
|
<filename>.rvm/src/ruby-1.9.3-p551/ext/sdbm/extconf.rb
require 'mkmf'
$defs << "-D""BADMESS=0"
create_makefile("sdbm")
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/xenserver/requests/compute/snapshot_revert.rb
|
<gh_stars>1-10
module Fog
module Compute
class XenServer
class Real
def revert_server( snapshot_ref, extra_args = {})
@connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.revert'}, snapshot_ref)
end
def snapshot_revert(snapshot_ref, extra_args = {})
Fog::Logger.deprecation(
'This method is deprecated. Use #revert_server instead.'
)
revert_server(snapshot_ref, extra_args)
end
end
class Mock
def revert_server()
Fog::Mock.not_implemented
end
end
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/rdoc/test_rdoc_attr.rb
|
# frozen_string_literal: false
require 'rdoc/test_case'
class TestRDocAttr < RDoc::TestCase
def setup
super
@a = RDoc::Attr.new nil, 'attr', 'RW', ''
end
def test_aref
m = RDoc::Attr.new nil, 'attr', 'RW', nil
assert_equal 'attribute-i-attr', m.aref
end
def test_arglists
assert_nil @a.arglists
end
def test_block_params
assert_nil @a.block_params
end
def test_call_seq
assert_nil @a.call_seq
end
def test_definition
assert_equal 'attr_accessor', @a.definition
@a.rw = 'R'
assert_equal 'attr_reader', @a.definition
@a.rw = 'W'
assert_equal 'attr_writer', @a.definition
end
def test_full_name
assert_equal '(unknown)#attr', @a.full_name
end
def test_marshal_dump
tl = @store.add_file 'file.rb'
@a.comment = 'this is a comment'
@a.record_location tl
cm = tl.add_class RDoc::NormalClass, 'Klass'
cm.add_attribute @a
section = cm.sections.first
loaded = Marshal.load Marshal.dump @a
loaded.store = @store
assert_equal @a, loaded
comment = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
assert_equal comment, loaded.comment
assert_equal 'file.rb', loaded.file.relative_name
assert_equal 'Klass#attr', loaded.full_name
assert_equal 'attr', loaded.name
assert_equal 'RW', loaded.rw
assert_equal false, loaded.singleton
assert_equal :public, loaded.visibility
assert_equal tl, loaded.file
assert_equal cm, loaded.parent
assert_equal section, loaded.section
end
def test_marshal_dump_singleton
tl = @store.add_file 'file.rb'
@a.comment = 'this is a comment'
@a.record_location tl
cm = tl.add_class RDoc::NormalClass, 'Klass'
cm.add_attribute @a
section = cm.sections.first
@a.rw = 'R'
@a.singleton = true
@a.visibility = :protected
loaded = Marshal.load Marshal.dump @a
loaded.store = @store
assert_equal @a, loaded
comment = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
assert_equal comment, loaded.comment
assert_equal 'Klass::attr', loaded.full_name
assert_equal 'attr', loaded.name
assert_equal 'R', loaded.rw
assert_equal true, loaded.singleton
assert_equal :protected, loaded.visibility
assert_equal tl, loaded.file
assert_equal cm, loaded.parent
assert_equal section, loaded.section
end
def test_marshal_load_version_1
tl = @store.add_file 'file.rb'
cm = tl.add_class RDoc::NormalClass, 'Klass'
section = cm.sections.first
data = "\x04\bU:\x0FRDoc::Attr[\fi\x06I\"\tattr\x06:\x06EF" +
"\"\x0FKlass#attrI\"\aRW\x06;\x06F:\vpublic" +
"o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
"o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
"\"\x16this is a comment\x06;\x06FF"
loaded = Marshal.load data
loaded.store = @store
comment = RDoc::Markup::Document.new(
RDoc::Markup::Paragraph.new('this is a comment'))
assert_equal comment, loaded.comment
assert_equal 'Klass#attr', loaded.full_name
assert_equal 'attr', loaded.name
assert_equal 'RW', loaded.rw
assert_equal false, loaded.singleton
assert_equal :public, loaded.visibility
# version 2
assert_nil loaded.file
# version 3
assert_equal cm, loaded.parent
assert_equal section, loaded.section
assert loaded.display?
end
def test_marshal_load_version_2
tl = @store.add_file 'file.rb'
cm = tl.add_class RDoc::NormalClass, 'Klass'
section = cm.sections.first
loaded = Marshal.load "\x04\bU:\x0FRDoc::Attr[\ri\aI\"\tattr\x06" +
":\x06ETI\"\x0FKlass#attr\x06;\x06TI\"\aRW\x06" +
";\x06T:\vpublico:\eRDoc::Markup::Document\a" +
":\v@parts[\x06o:\x1CRDoc::Markup::Paragraph\x06;" +
"\t[\x06I\"\x16this is a comment\x06;\x06T:\n" +
"@file0FI\"\ffile.rb\x06;\x06T"
loaded.store = @store
comment = doc(para('this is a comment'))
assert_equal comment, loaded.comment
assert_equal 'Klass#attr', loaded.full_name
assert_equal 'attr', loaded.name
assert_equal 'RW', loaded.rw
assert_equal false, loaded.singleton
assert_equal :public, loaded.visibility
assert_equal tl, loaded.file
# version 3
assert_equal cm, loaded.parent
assert_equal section, loaded.section
assert loaded.display?
end
def test_params
assert_nil @a.params
end
def test_singleton
refute @a.singleton
end
def test_type
assert_equal 'instance', @a.type
@a.singleton = true
assert_equal 'class', @a.type
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/gssapi-1.2.0/examples/gss_server.rb
|
<reponame>arnab0073/idea<filename>.rvm/gems/ruby-2.3.0/gems/gssapi-1.2.0/examples/gss_server.rb
require 'gssapi'
require 'base64'
require 'socket'
host = 'example.org'
service = 'host'
keytab = "#{ENV['HOME']}/.gssapi/krb5.keytab" # this is optional, but probably required if not running as root
tcpsrv = TCPServer.new(host, 8082)
loop do
Thread.start(tcpsrv.accept) do |s|
print(s, "Accepted Connection\n")
stok = s.gets.chomp
print(s, "Received string#{stok}\n")
srv = GSSAPI::Simple.new(host, service, keytab)
srv.acquire_credentials
otok = srv.accept_context(Base64.strict_decode64(stok.chomp))
s.write("#{Base64.strict_encode64(otok)}\n")
begin
emsg = s.gets.chomp
msg = srv.unwrap_message(Base64.strict_decode64(emsg.chomp))
puts "Received: #{msg}"
end while msg != 'exit'
print(s, "Closing Socket\n")
s.close
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/psych/visitors/test_depth_first.rb
|
<filename>.rvm/src/ruby-2.3.0/test/psych/visitors/test_depth_first.rb
# frozen_string_literal: false
require 'psych/helper'
module Psych
module Visitors
class TestDepthFirst < TestCase
class Collector < Struct.new(:calls)
def initialize(calls = [])
super
end
def call obj
calls << obj
end
end
def test_scalar
collector = Collector.new
visitor = Visitors::DepthFirst.new collector
visitor.accept Psych.parse_stream '--- hello'
assert_equal 3, collector.calls.length
end
def test_sequence
collector = Collector.new
visitor = Visitors::DepthFirst.new collector
visitor.accept Psych.parse_stream "---\n- hello"
assert_equal 4, collector.calls.length
end
def test_mapping
collector = Collector.new
visitor = Visitors::DepthFirst.new collector
visitor.accept Psych.parse_stream "---\nhello: world"
assert_equal 5, collector.calls.length
end
def test_alias
collector = Collector.new
visitor = Visitors::DepthFirst.new collector
visitor.accept Psych.parse_stream "--- &yay\n- foo\n- *yay\n"
assert_equal 5, collector.calls.length
end
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/winrm-1.8.1/lib/winrm/version.rb
|
<gh_stars>0
# encoding: UTF-8
# WinRM module
module WinRM
# The version of the WinRM library
VERSION = '1.8.1'
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/logging-2.1.0/lib/logging/proxy.rb
|
module Logging
# Defines a Proxy that will log all method calls on the proxied object. This
# class uses +method_missing+ on a "blank slate" object to intercept all
# method calls. The method name being called and the arguments are all
# logged to the proxied object's logger instance. The log level and other
# settings for the proxied object are honored by the Proxy instance.
#
# If you want, you can also supply your own +method_missing+ code as a block
# to the constructor.
#
# Proxy.new(object) do |name, *args, &block|
# # code to be executed before the proxied method
# result = @object.send(name, *args, &block)
# # code to be executed after the proxied method
# result # <-- always return the result
# end
#
# The proxied object is available as the "@object" variable. The logger is
# available as the "@logger" variable.
#
class Proxy
# :stopdoc:
KEEPERS = %r/^__|^object_id$|^initialize$/
instance_methods(true).each { |m| undef_method m unless m[KEEPERS] }
private_instance_methods(true).each { |m| undef_method m unless m[KEEPERS] }
# :startdoc:
# Create a new proxy for the given _object_. If an optional _block_ is
# given it will be called before the proxied method. This _block_ will
# replace the +method_missing+ implementation
#
def initialize( object, &block )
Kernel.raise ArgumentError, "Cannot proxy nil" if nil.equal? object
@object = object
@leader = @object.is_a?(Class) ? "#{@object.name}." : "#{@object.class.name}#"
@logger = Logging.logger[object]
if block
eigenclass = class << self; self; end
eigenclass.__send__(:define_method, :method_missing, &block)
end
end
# All hail the magic of method missing. Here is where we are going to log
# the method call and then forward to the proxied object. The return value
# from the proxied objet method call is passed back.
#
def method_missing( name, *args, &block )
@logger << "#@leader#{name}(#{args.inspect[1..-2]})\n"
@object.send(name, *args, &block)
end
end # Proxy
end # Logging
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/sample/openssl/cipher.rb
|
<reponame>arnab0073/idea
#!/usr/bin/env ruby
require 'openssl'
def crypt_by_password(alg, pass, salt, text)
puts "--Setup--"
puts %(cipher alg: "#{alg}")
puts %(plain text: "#{text}")
puts %(password: "#{pass}")
puts %(salt: "#{salt}")
puts
puts "--Encrypting--"
enc = OpenSSL::Cipher::Cipher.new(alg)
enc.encrypt
enc.pkcs5_keyivgen(pass, salt)
cipher = enc.update(text)
cipher << enc.final
puts %(encrypted text: #{cipher.inspect})
puts
puts "--Decrypting--"
dec = OpenSSL::Cipher::Cipher.new(alg)
dec.decrypt
dec.pkcs5_keyivgen(pass, salt)
plain = dec.update(cipher)
plain << dec.final
puts %(decrypted text: "#{plain}")
puts
end
def ciphers
ciphers = OpenSSL::Cipher.ciphers.sort
ciphers.each{|i|
if i.upcase != i && ciphers.include?(i.upcase)
ciphers.delete(i)
end
}
return ciphers
end
puts "Supported ciphers in #{OpenSSL::OPENSSL_VERSION}:"
ciphers.each_with_index{|name, i|
printf("%-15s", name)
puts if (i + 1) % 5 == 0
}
puts
puts
alg = ARGV.shift || ciphers.first
pass = "<PASSWORD>"
salt = "<PASSWORD>" # or nil
text = "abcdefghijklmnopqrstuvwxyz"
crypt_by_password(alg, pass, salt, text)
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/gssapi-1.2.0/test/spec/test_buffer_spec.rb
|
<gh_stars>1-10
$: << File.dirname(__FILE__) + '/../../lib/'
require 'gssapi'
describe GSSAPI::LibGSSAPI::UnManagedGssBufferDesc, 'Unmanaged Buffer Test' do
it 'should create a new UnManagedGssBufferDesc and assign to it and test GC' do
0.upto 100 do |i|
b = GSSAPI::LibGSSAPI::UnManagedGssBufferDesc.new
GC.start
b.value = 'asdf'
end
# If we get here without any errors we should be golden
true.should be_true
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/mixlib-cli-1.6.0/spec/spec_helper.rb
|
<reponame>arnab0073/idea
$TESTING = true
$:.push File.join(File.dirname(__FILE__), "..", "lib")
require "mixlib/cli"
class TestCLI
include Mixlib::CLI
end
RSpec.configure do |config|
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
config.treat_symbols_as_metadata_keys_with_true_values = true
config.warnings = true
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb
|
<reponame>arnab0073/idea
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5,
:fixed=>true, :range=>[32, 212]).pack(:pady=>10)
Tk.mainloop
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/rubyntlm-0.6.0/spec/lib/net/ntlm/message_spec.rb
|
require 'spec_helper'
describe Net::NTLM::Message do
fields = []
flags = [
:UNICODE,
:OEM,
:REQUEST_TARGET,
:NTLM,
:ALWAYS_SIGN,
:NTLM2_KEY
]
it_behaves_like 'a fieldset', fields
it_behaves_like 'a message', flags
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/win32ole/sample/ienavi.rb
|
require 'win32ole'
$urls = []
def navigate(url)
$urls << url
end
def stop_msg_loop
puts "Now Stop IE..."
$LOOP = FALSE;
end
def default_handler(event, *args)
case event
when "BeforeNavigate"
puts "Now Navigate #{args[0]}..."
end
end
ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = TRUE
ie.gohome
ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
ev.on_event {|*args| default_handler(*args)}
ev.on_event("NavigateComplete") {|url| navigate(url)}
ev.on_event("Quit") {|*args| stop_msg_loop}
$LOOP = TRUE
while ($LOOP)
WIN32OLE_EVENT.message_loop
end
puts "You Navigated the URLs ..."
$urls.each_with_index do |url, i|
puts "(#{i+1}) #{url}"
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/test/ruby/test_bignum.rb
|
<gh_stars>0
require 'test/unit'
class TestBignum < Test::Unit::TestCase
def setup
@verbose = $VERBOSE
$VERBOSE = nil
@fmax = Float::MAX.to_i
@fmax2 = @fmax * 2
@big = (1 << 63) - 1
end
def teardown
$VERBOSE = @verbose
end
def fact(n)
return 1 if n == 0
f = 1
while n>0
f *= n
n -= 1
end
return f
end
def test_bignum
$x = fact(40)
assert_equal($x, $x)
assert_equal($x, fact(40))
assert($x < $x+2)
assert($x > $x-2)
assert_equal(815915283247897734345611269596115894272000000000, $x)
assert_not_equal(815915283247897734345611269596115894272000000001, $x)
assert_equal(815915283247897734345611269596115894272000000001, $x+1)
assert_equal(335367096786357081410764800000, $x/fact(20))
$x = -$x
assert_equal(-815915283247897734345611269596115894272000000000, $x)
assert_equal(2-(2**32), -(2**32-2))
assert_equal(2**32 - 5, (2**32-3)-2)
for i in 1000..1014
assert_equal(2 ** i, 1 << i)
end
n1 = 1 << 1000
for i in 1000..1014
assert_equal(n1, 1 << i)
n1 *= 2
end
n2=n1
for i in 1..10
n1 = n1 / 2
n2 = n2 >> 1
assert_equal(n1, n2)
end
for i in 4000..4096
n1 = 1 << i;
assert_equal(n1-1, (n1**2-1) / (n1+1))
end
end
def test_calc
b = 10**80
a = b * 9 + 7
assert_equal(7, a.modulo(b))
assert_equal(-b + 7, a.modulo(-b))
assert_equal(b + -7, (-a).modulo(b))
assert_equal(-7, (-a).modulo(-b))
assert_equal(7, a.remainder(b))
assert_equal(7, a.remainder(-b))
assert_equal(-7, (-a).remainder(b))
assert_equal(-7, (-a).remainder(-b))
assert_equal(10000000000000000000100000000000000000000, 10**40+10**20)
assert_equal(100000000000000000000, 10**40/10**20)
a = 677330545177305025495135714080
b = 14269972710765292560
assert_equal(0, a % b)
assert_equal(0, -a % b)
end
def shift_test(a)
b = a / (2 ** 32)
c = a >> 32
assert_equal(b, c)
b = a * (2 ** 32)
c = a << 32
assert_equal(b, c)
end
def test_shift
shift_test(-4518325415524767873)
shift_test(-0xfffffffffffffffff)
end
def test_to_s
assert_equal("fvvvvvvvvvvvv" ,18446744073709551615.to_s(32), "[ruby-core:10686]")
assert_equal("g000000000000" ,18446744073709551616.to_s(32), "[ruby-core:10686]")
assert_equal("3w5e11264sgsf" ,18446744073709551615.to_s(36), "[ruby-core:10686]")
assert_equal("3w5e11264sgsg" ,18446744073709551616.to_s(36), "[ruby-core:10686]")
assert_equal("nd075ib45k86f" ,18446744073709551615.to_s(31), "[ruby-core:10686]")
assert_equal("nd075ib45k86g" ,18446744073709551616.to_s(31), "[ruby-core:10686]")
assert_equal("1777777777777777777777" ,18446744073709551615.to_s(8))
assert_equal("-1777777777777777777777" ,-18446744073709551615.to_s(8))
end
T_ZERO = (2**32).coerce(0).first
T_ONE = (2**32).coerce(1).first
T_MONE = (2**32).coerce(-1).first
T31 = 2**31 # 2147483648
T31P = T31 - 1 # 2147483647
T32 = 2**32 # 4294967296
T32P = T32 - 1 # 4294967295
T64 = 2**64 # 18446744073709551616
T64P = T64 - 1 # 18446744073709551615
def test_big_2comp
assert_equal("-4294967296", (~T32P).to_s)
assert_equal("..f00000000", "%x" % -T32)
end
def test_int2inum
assert_equal([T31P], [T31P].pack("I").unpack("I"))
assert_equal([T31P], [T31P].pack("i").unpack("i"))
end
def test_quad_pack
assert_equal([ 1], [ 1].pack("q").unpack("q"))
assert_equal([- 1], [- 1].pack("q").unpack("q"))
assert_equal([ T31P], [ T31P].pack("q").unpack("q"))
assert_equal([-T31P], [-T31P].pack("q").unpack("q"))
assert_equal([ T64P], [ T64P].pack("Q").unpack("Q"))
assert_equal([ 0], [ T64 ].pack("Q").unpack("Q"))
end
def test_str_to_inum
assert_equal(1, " +1".to_i)
assert_equal(-1, " -1".to_i)
assert_equal(0, "++1".to_i)
assert_equal(73, "111".oct)
assert_equal(273, "0x111".oct)
assert_equal(7, "0b111".oct)
assert_equal(73, "0o111".oct)
assert_equal(111, "0d111".oct)
assert_equal(73, "0111".oct)
assert_equal(111, Integer("111"))
assert_equal(13, "111".to_i(3))
assert_raise(ArgumentError) { "111".to_i(37) }
assert_equal(1333, "111".to_i(36))
assert_equal(1057, "111".to_i(32))
assert_equal(0, "00a".to_i)
assert_equal(1, Integer("1 "))
assert_raise(ArgumentError) { Integer("1_") }
assert_raise(ArgumentError) { Integer("1__") }
assert_raise(ArgumentError) { Integer("1_0 x") }
assert_equal(T31P, "1111111111111111111111111111111".to_i(2))
assert_equal(0_2, '0_2'.to_i)
assert_equal(00_2, '00_2'.to_i)
assert_equal(00_02, '00_02'.to_i)
end
def test_to_s2
assert_raise(ArgumentError) { T31P.to_s(37) }
assert_equal("9" * 32768, (10**32768-1).to_s)
assert_raise(RangeError) { Process.wait(1, T64P) }
assert_equal("0", T_ZERO.to_s)
assert_equal("1", T_ONE.to_s)
end
def test_to_f
assert_nothing_raised { T31P.to_f.to_i }
assert_raise(FloatDomainError) { (1024**1024).to_f.to_i }
assert_equal(1, (2**50000).to_f.infinite?)
assert_equal(-1, (-(2**50000)).to_f.infinite?)
end
def test_cmp
assert(T31P > 1)
assert(T31P < 2147483648.0)
assert(T31P < T64P)
assert(T64P > T31P)
assert_raise(ArgumentError) { T31P < "foo" }
assert(T64 < (1.0/0.0))
assert(!(T64 > (1.0/0.0)))
end
def test_eq
assert(T31P != 1)
assert(T31P == 2147483647.0)
assert(T31P != "foo")
assert(2**77889 != (1.0/0.0), '[ruby-core:31603]')
end
def test_eql
assert(T31P.eql?(T31P))
end
def test_convert
assert_equal([255], [T_MONE].pack("C").unpack("C"))
assert_equal([0], [T32].pack("C").unpack("C"))
assert_raise(RangeError) { 0.to_s(T32) }
end
def test_sub
assert_equal(-T31, T32 - (T32 + T31))
x = 2**100
assert_equal(1, (x+2) - (x+1))
assert_equal(-1, (x+1) - (x+2))
assert_equal(0, (2**100) - (2.0**100))
o = Object.new
def o.coerce(x); [x, 2**100+2]; end
assert_equal(-1, (2**100+1) - o)
assert_equal(-1, T_ONE - 2)
end
def test_plus
assert_equal(T32.to_f, T32P + 1.0)
assert_raise(TypeError) { T32 + "foo" }
assert_equal(1267651809154049016125877911552, (2**100) + (2**80))
assert_equal(1267651809154049016125877911552, (2**80) + (2**100))
assert_equal(2**101, (2**100) + (2.0**100))
o = Object.new
def o.coerce(x); [x, 2**80]; end
assert_equal(1267651809154049016125877911552, (2**100) + o)
end
def test_minus
assert_equal(T32P.to_f, T32 - 1.0)
assert_raise(TypeError) { T32 - "foo" }
end
def test_mul
assert_equal(T32.to_f, T32 * 1.0)
assert_raise(TypeError) { T32 * "foo" }
o = Object.new
def o.coerce(x); [x, 2**100]; end
assert_equal(2**180, (2**80) * o)
end
def test_mul_balance
assert_equal(3**7000, (3**5000) * (3**2000))
end
def test_mul_large_numbers
a = %w[
32580286268570032115047167942578356789222410206194227403993117616454027392
62501901985861926098797067562795526004375784403965882943322008991129440928
33855888840298794008677656280486901895499985197580043127115026675632969396
55040226415022070581995493731570435346323030715226718346725312551631168110
83966158581772380474470605428802018934282425947323171408377505151988776271
85865548747366001752375899635539662017095652855537225416899242508164949615
96848508410008685252121247181772953744297349638273854170932226446528911938
03430429031094465344063914822790537339912760237589085026016396616506014081
53557719631183538265614091691713138728177917059624255801026099255450058876
97412698978242128457751836011774504753020608663272925708049430557191193188
23212591809241860763625985763438355314593186083254640117460724730431447842
15432124830037389073162094304199742919767272162759192882136828372588787906
96027938532441670018954643423581446981760344524184231299785949158765352788
38452309862972527623669323263424418781899966895996672291193305401609553502
63893514163147729201340204483973131948541009975283778189609285614445485714
63843850089417416331356938086609682943037801440660232801570877143192251897
63026816485314923378023904237699794122181407920355722922555234540701118607
37971417665315821995516986204709574657462370947443531049033704997194647442
13711787319587466437795542850136751816475182349380345341647976135081955799
56787050815348701001765730577514591032367920292271016649813170789854524395
72571698998841196411826453893352760318867994518757872432266374568779920489
55597104558927387008506485038236352630863481679853742412042588244086070827
43705456833283086410967648483312972903432798923897357373793064381177468258
69131640408147806442422254638590386673344704147156793990832671592488742473
31524606724894164324227362735271650556732855509929890983919463699819116427
].join.to_i
b = %w[
31519454770031243652776765515030872050264386564379909299874378289835540661
99756262835346828114038365624177182230027040172583473561802565238817167503
85144159132462819032164726177606533272071955542237648482852154879445654746
25061253606344846225905712926863168413666058602449408307586532461776530803
56810626880722653177544008166119272373179841889454920521993413902672848145
77974951972342194855267960390195830413354782136431833731467699250684103370
98571305167189174270854698169136844578685346745340041520068176478277580590
43810457765638903028049263788987034217272442328962400931269515791911786205
15357047519615932249418012945178659435259428163356223753159488306813844040
93609959555018799309373542926110109744437994067754004273450659607204900586
28878103661124568217617766580438460505513654179249613168352070584906185237
34829991855182473813233425492094534396541544295119674419522772382981982574
64708442087451070125274285088681225122475041996116377707892328889948526913
82239084041628877737628853240361038273348062246951097300286513836140601495
63604611754185656404194406869925540477185577643853560887894081047256701731
66884554460428760857958761948461476977864005799494946578017758268987123749
85937011490156431231903167442071541493304390639100774497107347884381581049
85451663323551635322518839895028929788021096587229364219084708576998525298
39594168681411529110089531428721005176467479027585291807482375043729783455
35827667428080449919778142400266842990117940984804919512360370451936835708
76338722049621773169385978521438867493162717866679193103745711403152099047
27294943901673885707639094215339506973982546487889199083181789561917985023
82368442718514694400160954955539704757794969665555505203532944598698824542
00599461848630034847211204029842422678421808487300084850702007663003230882
16645745324467830796203354080471008809087072562876681588151822072260738003
].join.to_i
c = %w[
10269128594368631269792194698469828812223242061960065022209211719149714886
03494742299892841188636314745174778237781513956755034582435818316155459882
71422025990633195596790290038198841087091600598192959108790192789550336119
13849937951116346796903163312950010689963716629093190601532313463306463573
64436438673379454947908896258675634478867189655764364639888427350090856831
84369949421175534994092429682748078316130135651006102162888937624830856951
64818150356583421988135211585954838926347035741143424980258821170351244310
33072045488402539147707418016613224788469923473310249137422855065567940804
75231970365923936034328561426062696074717204901606475826224235014948198414
19979210494282212322919438926816203585575357874850252052656098969732107129
30639419804565653489687198910271702181183420960744232756057631336661646896
48734093497394719644969417287962767186599484579769717220518657324467736902
16947995288312851432262922140679347615046098863974141226499783975470926697
95970415188661518504275964397022973192968233221707696639386238428211541334
69925631385166494600401675904803418143232703594169525858261988389529181035
06048776134746377586210180203524132714354779486439559392942733781343640971
02430607931736785273011780813863748280091795277451796799961887248262211653
38966967509803488282644299584920109534552889962877144862747797551711984992
00726518175235286668236031649728858774545087668286506201943248842967749907
05345423019480534625965140632428736051632750698608916592720742728646191514
86268964807395494825321744802493138032936406889713953832376411900451422777
06372983421062172556566901346288286168790235741528630664513209619789835729
36999522461733403414326366959273556098219489572448083984779946889707480205
42459898495081687425132939473146331452400120169525968892769310016015870148
66821361032541586130017904207971120217385522074967066199941112154460026348
07223950375610474071278649031647998546085807777970592429037128484222394216
33776560239741740193444702279919018283324070210090106960567819910943036248
16660475627526085805165023447934326510232828674828006752369603151390527384
16810180735871644266726954590262010744712519045524839388305761859432443670
05188791334908140831469790180096209292338569623252372975043915954675335333
66614002146554533771788633057869340167604765688639181655208751680821446276
75871494160208888666798836473728725968253820774671626436794492530356258709
62318715778035246655925307167306434486713879511272648637608703497794724929
54912261106702913491290913962825303534484477936036071463820553314826894581
36951927032835690160443252405644718368516656317176848748544135126122940034
68454782581240953957381976073459570718038035358630417744490242611126043987
89191812971310096496208294948623403471433467614886863238916702384858514703
24327715474804343531844042107910755966152655912676456945146277848606406879
49724219295823540160221752189725460676360350860849986313532861445465771187
86822806696323658053947125253562001971534265078959827450518368635828010637
91977444206363529864361796188661941906329947840521598310396004328950804758
79728679236044038853668859284513594307352133390781441610395116807369310560
35193762565748328526426224069629084264376146174383444988110993194030351064
29660536743256949099972314033972121470913480844652490838985461134989129492
75577567064571716731774820127381261057956083604361635892088585967074514802
51958582645785905276289980534832170529946494815794770854644518463332458915
77572397432680871220602513555535017751714443325264019171753694163676670792
04353584782364068773777058727187323211012094819929720407636607815292764459
21851731257845562153822058534043916834839514338448582518847879059020959697
90538105704766415685100946308842788321400392381169436435078204622400475281
].join.to_i
assert_equal(c, a*b, '[ruby-core:48552]')
end
def test_divrem
assert_equal(0, T32 / T64)
end
def test_div
assert_equal(T32.to_f, T32 / 1.0)
assert_raise(TypeError) { T32 / "foo" }
assert_equal(0x20000000, 0x40000001.div(2.0), "[ruby-dev:34553]")
end
def test_idiv
assert_equal(715827882, 1073741824.div(Rational(3,2)), ' [ruby-dev:34066]')
end
def test_modulo
assert_raise(TypeError) { T32 % "foo" }
end
def test_remainder
assert_equal(0, T32.remainder(1))
assert_raise(TypeError) { T32.remainder("foo") }
end
def test_divmod
assert_equal([T32, 0], T32.divmod(1))
assert_equal([2, 0], T32.divmod(T31))
assert_raise(TypeError) { T32.divmod("foo") }
end
def test_quo
assert_equal(T32.to_f, T32.quo(1))
assert_equal(T32.to_f, T32.quo(1.0))
assert_equal(T32.to_f, T32.quo(T_ONE))
assert_raise(TypeError) { T32.quo("foo") }
assert_equal(1024**1024, (1024**1024).quo(1))
assert_equal(1024**1024, (1024**1024).quo(1.0))
assert_equal(1024**1024*2, (1024**1024*2).quo(1))
inf = 1 / 0.0; nan = inf / inf
assert((1024**1024*2).quo(nan).nan?)
end
def test_pow
assert_equal(1.0, T32 ** 0.0)
assert_equal(1.0 / T32, T32 ** -1)
assert_equal(1, (T32 ** T32).infinite?)
assert_equal(1, (T32 ** (2**30-1)).infinite?)
### rational changes the behavior of Bignum#**
#assert_raise(TypeError) { T32**"foo" }
assert_raise(TypeError, ArgumentError) { T32**"foo" }
feature3429 = '[ruby-core:30735]'
assert_instance_of(Bignum, (2 ** 7830457), feature3429)
end
def test_and
assert_equal(0, T32 & 1)
assert_equal(-T32, (-T32) & (-T31))
assert_equal(0, T32 & T64)
end
def test_or
assert_equal(T32 + 1, T32 | 1)
assert_equal(T32 + T31, T32 | T31)
assert_equal(-T31, (-T32) | (-T31))
assert_equal(T64 + T32, T32 | T64)
end
def test_xor
assert_equal(T32 + 1, T32 ^ 1)
assert_equal(T32 + T31, T32 ^ T31)
assert_equal(T31, (-T32) ^ (-T31))
assert_equal(T64 + T32, T32 ^ T64)
end
def test_shift2
assert_equal(2**33, (2**32) << 1)
assert_equal(2**31, (2**32) << -1)
assert_equal(2**33, (2**32) << 1.0)
assert_equal(2**31, (2**32) << -1.0)
assert_equal(2**33, (2**32) << T_ONE)
assert_equal(2**31, (2**32) << T_MONE)
assert_equal(2**31, (2**32) >> 1)
assert_equal(2**33, (2**32) >> -1)
assert_equal(2**31, (2**32) >> 1.0)
assert_equal(2**33, (2**32) >> -1.0)
assert_equal(2**31, (2**32) >> T_ONE)
assert_equal(2**33, (2**32) >> T_MONE)
assert_equal( 0, (2**32) >> (2**32))
assert_equal(-1, -(2**32) >> (2**32))
assert_equal( 0, (2**32) >> 128)
assert_equal(-1, -(2**32) >> 128)
assert_equal( 0, (2**31) >> 32)
assert_equal(-1, -(2**31) >> 32)
end
def test_aref
assert_equal(0, (2**32)[0])
assert_equal(0, (2**32)[2**32])
assert_equal(0, (2**32)[-(2**32)])
assert_equal(0, (2**32)[T_ZERO])
assert_equal(0, (-(2**64))[0])
assert_equal(1, (-2**256)[256])
end
def test_hash
assert_nothing_raised { T31P.hash }
end
def test_coerce
assert_equal([T64P, T31P], T31P.coerce(T64P))
assert_raise(TypeError) { T31P.coerce(nil) }
end
def test_abs
assert_equal(T31P, (-T31P).abs)
end
def test_size
assert(T31P.size.is_a?(Integer))
end
def test_odd
assert_equal(true, (2**32+1).odd?)
assert_equal(false, (2**32).odd?)
end
def test_even
assert_equal(false, (2**32+1).even?)
assert_equal(true, (2**32).even?)
end
def assert_interrupt
time = Time.now
start_flag = false
end_flag = false
thread = Thread.new do
start_flag = true
yield
end_flag = true
end
Thread.pass until start_flag
thread.raise
thread.join rescue nil
time = Time.now - time
assert_equal([true, false], [start_flag, end_flag])
assert_operator(time, :<, 10)
end
def test_interrupt
assert_interrupt {(65536 ** 65536).to_s}
end
def test_too_big_to_s
if (big = 2**31-1).is_a?(Fixnum)
return
end
e = assert_raise(RangeError) {(1 << big).to_s}
assert_match(/too big to convert/, e.message)
end
def test_fix_fdiv
assert_not_equal(0, 1.fdiv(@fmax2))
assert_in_delta(0.5, 1.fdiv(@fmax2) * @fmax, 0.01)
end
def test_big_fdiv
assert_equal(1, @big.fdiv(@big))
assert_not_equal(0, @big.fdiv(@fmax2))
assert_not_equal(0, @fmax2.fdiv(@big))
assert_not_equal(0, @fmax2.fdiv(@fmax2))
assert_in_delta(0.5, @fmax.fdiv(@fmax2), 0.01)
assert_in_delta(1.0, @fmax2.fdiv(@fmax2), 0.01)
end
def test_float_fdiv
b = 1E+300.to_i
assert_equal(b, (b ** 2).fdiv(b))
assert(@big.fdiv(0.0 / 0.0).nan?)
assert_in_delta(1E+300, (10**500).fdiv(1E+200), 1E+285)
end
def test_obj_fdiv
o = Object.new
def o.coerce(x); [x, 2**100]; end
assert_equal((2**200).to_f, (2**300).fdiv(o))
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rubygems/ext.rb
|
<reponame>arnab0073/idea
# frozen_string_literal: false
#--
# Copyright 2006 by <NAME>, <NAME>, <NAME> and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
##
# Classes for building C extensions live here.
module Gem::Ext; end
require 'rubygems/ext/build_error'
require 'rubygems/ext/builder'
require 'rubygems/ext/configure_builder'
require 'rubygems/ext/ext_conf_builder'
require 'rubygems/ext/rake_builder'
require 'rubygems/ext/cmake_builder'
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/scanf/test_scanf.rb
|
<filename>.rvm/src/ruby-2.3.0/test/scanf/test_scanf.rb
# frozen_string_literal: false
# $Id: test_scanf.rb 53141 2015-12-16 05:07:31Z naruse $
#
# scanf for Ruby
#
# Unit tests
#
require 'scanf.rb'
require 'test/unit'
require 'tempfile'
# Comment out either of these lines to skip those tests.
class TestStringScanf < Test::Unit::TestCase;end
class TestIOScanf < Test::Unit::TestCase;end
module ScanfTests
def tests
[
# Scratchpad
[ "%2[a]", "nbc", []],
[ "%*d %*3d %*s", "123 +456 abc", [] ],
[ "%d%c", "123 x", [ 123, " " ] ],
[ "%d%c", "123x", [ 123, "x" ] ],
[ "%d %c", "123x", [ 123, "x" ] ],
[ "%d %c", "123 x", [ 123, "x" ] ],
# Testing failures
[ "%x", "x", [] ],
[ "%2x", "x", [] ],
[ "%i", "x", [] ],
# ]; end; def nothing; [
[ "%2i", "x", [] ],
[ "%2o", "x", [] ],
[ "%d", "x", [] ],
[ "%2d", "x", [] ],
[ "%3d", "+x3", [] ],
[ "%d%[abc]", "eabc", [] ],
[ "%d\n%[abc]", "\neabc", [] ],
[ "%d%[^abc]", "ghiabc", [ ] ],
[ "%d%[abc]", "abc", [] ],
[ "%d%s", "", [] ],
[ "%d%s", "blah 123 string", [] ],
[ "%[\n]", "abc\n", [] ],
[ "%f", "x", [] ],
[ "%f", "z", [] ],
[ "%f", "z3.2534", [] ],
[ "", "", [] ],
[ "", "abc 123", [] ],
[ '%[^\\w]%c', "a...1", [] ],
# Testing 'x'
[ "%3x", "0xz", [0] ],
# Testing 'i'
[ "%3i", "097", [0] ],
[ "%3i", "0xz", [0] ],
[ "%1i", "3", [ 3 ] ],
[ "%2i", "07", [ 7 ] ],
[ "%2i", "0a", [ 0 ] ],
# Testing 'c'
[ "%3c", "abc", [ "abc" ] ],
[ "%3c", "a\nb", [ "a\nb" ] ],
[ "%3c", "a\nbcd", [ "a\nb" ] ],
[ "%c\n\n", "x\n\n", [ "x" ] ],
[ "%c", "\n", [ "\n" ] ],
[ "%c", "x\n", [ "x" ] ],
[ "%2c", " 123", [" 1"] ],
[ " %c", " x", ["x"] ],
[ "%c", " x", [" "] ],
[ "%c", "123", ["1"] ],
[ "%2c", "123", ["12"] ],
[ "%5c", "a\nb\n\n", [ "a\nb\n\n" ] ],
[ "%6c", "a\nb\n\nx", [ "a\nb\n\nx" ] ],
[ "%5c", "ab\ncd", [ "ab\ncd" ] ],
# Testing 'o'
[ "%3o", "0xz", [0] ],
# Testing 'd'
[ "%d", "\n123", [ 123 ] ],
[ "%d", "\n\n123", [ 123 ] ],
[ "%1d", "2", [2] ],
# Mixed tests
# Includes:
# whitespace/newline
# mixed integer bases
# various mixed specifiers
[ "%[^\\w]%c", "...1", [ "...", "1"] ],
[ "%[abc\n]%d", "a\n\nb\n\nc 123", [ "a\n\nb\n\nc", 123 ] ],
[ "%[abc\n]%d", "a\n\nb\n\nc \t 123", [ "a\n\nb\n\nc", 123 ] ],
[ "%[abc\t]%d", "a\t\tb\t\tc 123", [ "a\t\tb\t\tc", 123 ] ],
[ "%d%3[abc\n]", "123a\nbeaab", [ 123, "a\nb" ] ],
[ "%d%20c", "42 is the key", [ 42, " is the key" ] ],
[ "%d %20c", "42 is the key", [ 42, "is the key" ] ],
[ "%d%3[^abc\n]%d", "123de\nf123", [ 123, "de" ] ],
[ "%d %4c", "3abc", [ 3, "abc" ] ],
[ "%f%d\n%[abc]", "1\neabc", [1.0] ],
[ "%d%3[abc]", "123aaab", [ 123, "aaa" ] ],
[ "%d%3[abc]", "123 aaab", [ 123 ] ],
[ "%d%3[abc]", "123aeaab", [ 123, "a" ] ],
[ "%d%[^abc]", "123defabc", [123, "def" ] ],
[ "%d%3[^abc]", "123defdef", [ 123, "def" ] ],
[ "%d%3[^abc] ", "123defdef ", [ 123, "def" ] ],
[ "%d%3[^abc]ghi", "123defghi", [ 123, "def" ] ],
[ "%d%3[^abc]", "123adefdef", [ 123 ] ],
[ "%d%3[^abc]", "123deafdef", [ 123, "de" ] ],
[ "%d%3[^abc\n]", "123de\nf", [ 123, "de" ] ],
[ "%s%c%c%s", "abc\n\ndef", ["abc", "\n","\n", "def" ] ],
[ "%c%d", "\n\n123", [ "\n",123 ] ],
[ "%s%c%d", "abc\n123", [ "abc", "\n", 123 ] ],
[ "%s%c%d", "abc\n\n123", [ "abc", "\n", 123 ] ],
[ "%c%d", "\t\n123", [ "\t",123 ] ],
[ "%s%c%d", "abc\t\n123", [ "abc", "\t", 123 ] ],
[ "%3c%d", "abc123", [ "abc", 123 ] ],
[ "%3c\n%d", "abc123", [ "abc", 123 ] ],
[ "%3c\n%d", "abc 123", [ "abc", 123 ] ],
[ "%3c %d", "abc123", [ "abc", 123 ] ],
[ "%3c\t%d", "abc \n 123", [ "abc", 123 ] ],
[ "%3c\t%d", "abc \n 123 ", [ "abc", 123 ] ],
[ "%3c%d", "a\nb123", [ "a\nb", 123 ] ],
[ "%f%3c", "1.2x\ny", [ 1.2, "x\ny"] ],
[ "%d\n%d\n%d", "123 456 789", [ 123,456,789 ] ],
[ "%d\n%i%2d%x\n%d", "123 0718932", [ 123, 071, 89, 0x32] ],
[ "%c\n%c", "x y", [ "x", "y" ] ],
[ "%c\t%c", "x y", [ "x", "y" ] ],
[ "%s\n%s", "x y", [ "x", "y" ] ],
[ "%s%s\n", "x y", [ "x", "y" ] ],
[ "%c\n\n%c", "x\n\ny", [ "x", "y" ] ],
[ "%s%d%d", "abc\n123\n456", [ "abc", 123, 456 ] ],
[ "%3s%c%3c%d", "1.2x\n\ny123", [ "1.2", "x", "\n\ny", 123 ] ],
[ "%c\n%c", "x\n\ny", [ "x", "y" ] ],
[ "%c %c", "x\n\ny", [ "x", "y" ] ],
[ "%s\n\n%c", "x\n\ny", [ "x", "y" ] ],
[ "%s\n\n%s", "x\n\ny", [ "x", "y" ] ],
[ "%d\n\n%d", "23\n\n45", [ 23, 45 ] ],
[ "%d\n%d", "23\n\n45", [ 23, 45 ] ],
[ "%c\n\n%c", "x y", [ "x", "y" ] ],
[ "%c%c", "x\n\ny", [ "x", "\n" ] ],
[ "%c%c", "x\n", [ "x", "\n" ] ],
[ "%d%c%c%d", "345 678", [ 345, " ", " ", 678] ],
[ "%d %c%s", "123 x hello", [123, "x", "hello"] ],
[ "%d%2c", "654 123", [654," 1"] ],
[ "%5c%s", "a\nb\n\nxyz", [ "a\nb\n\n","xyz" ] ],
[ "%s%[ xyz]%d", "hello x 32", ["hello", " x ", 32] ],
[ "%5s%8[a-z]%d", "helloblahblah 32", ["hello", "blahblah", 32] ],
[ '%s%[abcde\\s]%d', "hello badea 32", ["hello", " badea ", 32] ],
[ '%d%[\\s]%c', "123 \n\t X", [ 123," \n\t ", "X"] ],
[ "%4s%2c%c", "1.2x\n\ny", [ "1.2x", "\n\n","y"] ],
[ "%f%c %3c%d", "1.2x\n\ny123", [ 1.2, "x", "y12", 3 ] ],
[ "%s%5c", "abc ab\ncd", [ "abc", " ab\nc" ] ],
[ "%5c%f", "ab\ncd1.2", [ "ab\ncd",1.2 ] ],
[ "%5c%c", "ab\ncd1", [ "ab\ncd","1" ] ],
[ "%f%c%2c%d", "1.2x\ny123", [ 1.2, "x", "\ny", 123 ] ],
[ "%f%c%3c", "1.2x\ny123", [ 1.2, "x", "\ny1"] ],
[ "%s\n%s", "blah\n\nand\nmore stuff", [ "blah", "and" ] ],
[ "%o%d%x", "21912a3", [ "21".oct, 912, "a3".hex ] ],
[ "%3o%4d%3x", "21912a3", [ "21".oct, 912, "a3".hex ] ],
[ "%3o%4d%5x", "2191240xa3", [ "21".oct, 9124, "a3".hex ] ],
[ "%3d%3x", "12abc", [12, "abc".hex] ],
[ "%s%i%d", "hello +0xdef 123", [ "hello", "def".hex, 123] ],
[ "%s%i%d", "hello -0xdef 123", [ "hello", -"def".hex, 123] ],
[ "%s%i%i%i%i", "hello 012 -012 100 1", [ "hello", 10, -10, 100, 1 ] ],
[ "%s%i%i%i%i", "hello 012 0x12 100 1", [ "hello", 10, 18, 100, 1 ] ],
[ "%s%5i%3i%4i", "hello 0x123 123 0123", [ "hello", "0x123".hex, 123,"0123".oct] ],
[ "%s%3i%4i", "hello 1230123", [ "hello", 123,"0123".oct] ],
[ "%s%3i", "hello 1230", [ "hello", 123] ],
[ "%s%5x%d", "hello 0xdef 123", [ "hello", "def".hex, 123] ],
[ "%s%6x%d", "hello +0xdef 123", [ "hello", "def".hex, 123] ],
[ "%s%6x%d", "hello -0xdef 123", [ "hello", -"def".hex, 123] ],
[ "%s%4x%d", "hello -def 123", [ "hello", -"def".hex, 123] ],
[ "%s%3x%d", "hello def 123", [ "hello", "def".hex, 123] ],
[ "%s%x%d", "hello -def 123", [ "hello", -"def".hex, 123] ],
[ "%s%x%d", "hello -0xdef 123", [ "hello", -"def".hex, 123] ],
[ "%s%x%d", "hello 0xdef 123", [ "hello", "def".hex, 123] ],
[ "%s%d%x%s", "hello 123 abc def", [ "hello", 123, "abc".hex, "def"] ],
[ "%s%d%o%d", "hello 012 012 100", [ "hello", 12, 10, 100 ] ],
[ "%s%d%o%d", "hello 012 -012 100", [ "hello", 12, -10, 100 ] ],
[ "%s%o%x%d", "hello 012 0x12 100", [ "hello", 10, 18, 100 ] ],
[ "%s%d%o%d", "hello 012 +01288", [ "hello", 12, 10, 88 ] ],
[ "%f %d %s", "12.3e23 45 string", ["12.3e23".to_f, 45, "string"] ],
[ "%f %d %s", "12.3e+23 45 string", ["12.3e23".to_f, 45, "string"] ],
[ "%f %d %s", "12.3e-23 45 string", ["12.3e-23".to_f, 45, "string"] ],
[ "%f %d %s", "-12.3e-23 45 string", ["-12.3e-23".to_f, 45, "string"] ],
[ "%f %d %s", "12.e23 45 string", ["12.e23".to_f, 45, "string"] ],
[ "%5f %d %s", "1.2e23 string", ["1.2e2".to_f, 3, "string"] ],
[ "%5f%d %s", "1.2e23 string", ["1.2e2".to_f, 3, "string"] ],
[ "%5f%d %d %s", "1.2e23 45 string", ["1.2e2".to_f, 3, 45, "string"] ],
[ "%6f %d %d %s", "+1.2e23 45 string", ["1.2e2".to_f, 3, 45, "string"] ],
[ "%d %d", "123 \n 345", [123, 345] ],
[ "%d %*d", "123 \n 345", [123] ],
[ "%d %3d789", "123 +45789", [123, 45] ],
[ "%d %3d%d", "123 +456789", [123, 45, 6789] ],
[ "%d %3dabc", "123 456abc", [123, 456] ],
[ "%d %s", "123abc", [123, "abc"] ],
[ "%d%s %s", "123 abc def", [123, "abc", "def"] ],
[ "%s%s", "abc123 def", ["abc123", "def"] ],
[ "%s%s %s", "123 abc def", ["123", "abc", "def"] ],
[ "%s%%%s", "abc % def", ["abc", "def"] ],
[ "%d %3d %s", "+123 456abc", [123, 456, "abc"] ],
[ "%d %3d %s", "123 456abc", [123, 456, "abc"] ],
[ "%d %3d %s", "123 +456 abc", [123, 45, "6"] ],
[ "%d %3d %s", "-123-456abc", [-123, -45, "6abc"] ],
[ "%dabc%d", "123abc345", [123, 345] ],
[ "%d%5s%d", "123 abcde12", [123, "abcde", 12] ],
[ "%5d%5s%5d", "12345abcde67890", [12345, "abcde", 67890] ],
[ "%5d%*5s%5d", "12345abcde67890", [12345, 67890] ],
[ " 12345%5s%5d", "12345abcde67890", [ "abcde", 67890] ],
[ "%5dabcde%5d", "12345abcde67890", [ 12345, 67890] ],
[ "%s%%%*s", "abc % def", ["abc"] ],
[ "%*6s %d", "string 123", [123] ],
[ "%d %*3d %s", "-123-456abc", [-123, "6abc"] ],
[ "%d%s", "123", [123] ],
[ "%s%d", "abc", ["abc"] ],
[ "%f%x", "3.2e45x", ["3.2e45x".to_f] ],
[ "%*5f%d %d %s", "1.2e23 45 string", [3, 45, "string"] ],
[ "%5f%*d %d %s", "1.2e23 45 string", ["1.2e2".to_f, 45, "string"] ],
[ "%*5f%*d %*d %s", "1.2e23 45 string", ["string"] ],
[ "%f %*d %s", "12.e23 45 string", ["12.e23".to_f, "string"] ],
[ "%s %f %s %d %x%c%c%c%c",
"float: 1.2e23 dec/hex: 135a23 abc",
["float:", "1.2e23".to_f, "dec/hex:", 135, "a23".hex, " ", "a", "b", "c" ] ],
# Testing 's'
[ "%s\n", "blah\n\n\n", [ "blah" ] ],
# Testing '['
[ "%[a\nb]", "a\nb", [ "a\nb" ] ],
[ "%[abc]", "acb", [ "acb" ] ],
[ "%[abc\n]", "a\nb", [ "a\nb" ] ],
[ "%[^abc]", "defabc", [ "def" ] ],
[ "%[-abc]", "abc-cba", [ "abc-cba" ] ],
[ "%[\n]", "\n", [ "\n" ] ],
[ "%[\n]", "\nabc", [ "\n" ] ],
[ "%[\n\t]", "\t\n", [ "\t\n" ] ],
[ "%[a-f]", "abczef", [ "abc" ] ],
[ "%d%3[[:lower:]] %f", "123ade1.2", [ 123,"ade",1.2 ] ],
[ "%d%3[[:lower:]] %f", "123ad1.2", [ 123,"ad",1.2 ] ],
[ "%d%3[[:lower:]] %f", "123 ad1.2", [ 123 ] ],
[ "%d%[[:lower:]]", "123abcdef1.2", [ 123, "abcdef" ] ],
[ "%[[:lower:]]%d", "abcdef123", [ "abcdef", 123 ] ],
[ "%[[:digit:]]%[[:alpha:]]", "123abcdef", [ "123", "abcdef" ] ],
[ "%[[:digit:]]%d", "123 123", [ "123", 123 ] ],
[ "%[[:upper:]]", "ABCdefGHI", [ "ABC" ] ],
# Testing 'f'
[ "%2f", "x", [] ],
[ "%F", "1.23e45", [1.23e+45] ],
[ "%e", "3.25ee", [3.25] ],
[ "%E", "3..25", [3.0] ],
[ "%g", "+3.25", [3.25] ],
[ "%G", "+3.25e2", [325.0] ],
[ "%f", "3.z", [3.0] ],
[ "%a", "0X1P+10", [1024.0] ],
[ "%A", "0x1.deadbeefp+99", [1.1851510441583988e+30] ],
# Testing embedded matches including literal '[' behavior
[",%d,%f", ",10,1.1", [10,1.1] ],
[" ,%d,%f", " ,10,1.1", [10,1.1] ],
["[%d,%f", "[10,1.1", [10,1.1] ],
[" [%d,%f", " [10,1.1", [10,1.1] ],
]
end
def each_test
self.tests.each do |test|
format, string, = test
yield test, "#{string.dump}(#{format.dump})"
end
end
end
class TestStringScanf
include Scanf
extend ScanfTests
self.each_test do |test, i|
define_method("test_#{i}") do ||
assert_equal(test[2], test[1].scanf(test[0]))
end
end
end
class TestIOScanf
include Scanf
extend ScanfTests
self.each_test do |test, i|
define_method("test_#{i}") do ||
Tempfile.create("iotest.dat") do |fh|
fh.print test[1]
fh.rewind
assert_equal(test[2], fh.scanf(test[0]))
end
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/knife-windows-1.4.1/features/support/env.rb
|
<filename>.rvm/gems/ruby-2.3.0/gems/knife-windows-1.4.1/features/support/env.rb
require 'aruba/cucumber'
Before do
@aruba_timeout_seconds = 5
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tcllib/statusbar.rb
|
<gh_stars>1-10
#
# tkextlib/tcllib/statusbar.rb
# by <NAME> (<EMAIL>)
#
# * Part of tcllib extension
# * statusbar widget
#
require 'tk'
require 'tkextlib/tcllib.rb'
# TkPackage.require('widget::statusbar', '1.2')
TkPackage.require('widget::statusbar')
module Tk::Tcllib
module Widget
class Statusbar < Tk::Tile::TFrame
PACKAGE_NAME = 'widget::statusbar'.freeze
def self.package_name
PACKAGE_NAME
end
def self.package_version
begin
TkPackage.require('widget::statusbar')
rescue
''
end
end
end
end
end
class Tk::Tcllib::Widget::Statusbar
TkCommandNames = ['::widget::statusbar'.freeze].freeze
def __boolval_optkeys
super() << 'separator' << 'resize' << 'resizeseparator'
end
private :__boolval_optkeys
def create_self(keys)
if keys and keys != None
tk_call_without_enc(self.class::TkCommandNames[0], @path,
*hash_kv(keys, true))
else
tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
def getframe
window(tk_send_without_enc('getframe'))
end
alias get_frame getframe
def add(w, keys={})
window(tk_send_without_enc('setwidget', *(hash_kv(keys))))
end
def remove(*wins)
tk_send_without_enc('remove', *wins)
self
end
def remove_with_destroy(*wins)
tk_send_without_enc('remove', '-destroy', *wins)
self
end
def delete(*wins)
tk_send_without_enc('delete', *wins)
self
end
def items(pat=None)
tk_split_list(tk_send('items', pat))
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/winrm-1.8.1/spec/auth_timeout_spec.rb
|
<filename>.rvm/gems/ruby-2.3.0/gems/winrm-1.8.1/spec/auth_timeout_spec.rb
# encoding: UTF-8
# This test may only be meaningful with kerberos auth
# Against server 2012, a kerberos connection will require reauth (get a 401)
# if there are no requests for >= 15 seconds
describe 'Verify kerberos will reauth when necessary', kerberos: true do
before(:all) do
@winrm = winrm_connection
end
it 'work with a 18 second sleep' do
ps_command = 'Start-Sleep -s 18'
output = @winrm.run_powershell_script(ps_command)
output[:exitcode].should == 0
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/net-ssh-multi-1.2.0/lib/net/ssh/multi/pending_connection.rb
|
require 'net/ssh/multi/channel_proxy'
module Net; module SSH; module Multi
# A PendingConnection instance mimics a Net::SSH::Connection::Session instance,
# without actually being an open connection to a server. It is used by
# Net::SSH::Multi::Session when a concurrent connection limit is in effect,
# so that a server can hang on to a "connection" that isn't really a connection.
#
# Any requests against this connection (like #open_channel or #send_global_request)
# are not actually sent, but are added to a list of recordings. When the real
# session is opened and replaces this pending connection, all recorded actions
# will be replayed against that session.
#
# You'll never need to initialize one of these directly, and (if all goes well!)
# should never even notice that one of these is in use. Net::SSH::Multi::Session
# will instantiate these as needed, and only when there is a concurrent
# connection limit.
class PendingConnection
# Represents a #open_channel action.
class ChannelOpenRecording #:nodoc:
attr_reader :type, :extras, :channel
def initialize(type, extras, channel)
@type, @extras, @channel = type, extras, channel
end
def replay_on(session)
real_channel = session.open_channel(type, *extras, &channel.on_confirm)
channel.delegate_to(real_channel)
end
end
# Represents a #send_global_request action.
class SendGlobalRequestRecording #:nodoc:
attr_reader :type, :extra, :callback
def initialize(type, extra, callback)
@type, @extra, @callback = type, extra, callback
end
def replay_on(session)
session.send_global_request(type, *extra, &callback)
end
end
# The Net::SSH::Multi::Server object that "owns" this pending connection.
attr_reader :server
# Instantiates a new pending connection for the given Net::SSH::Multi::Server
# object.
def initialize(server)
@server = server
@recordings = []
end
# Instructs the pending session to replay all of its recordings against the
# given +session+, and to then replace itself with the given session.
def replace_with(session)
@recordings.each { |recording| recording.replay_on(session) }
@server.replace_session(session)
end
# Records that a channel open request has been made, and returns a new
# Net::SSH::Multi::ChannelProxy object to represent the (as yet unopened)
# channel.
def open_channel(type="session", *extras, &on_confirm)
channel = ChannelProxy.new(&on_confirm)
@recordings << ChannelOpenRecording.new(type, extras, channel)
return channel
end
# Records that a global request has been made. The request is not actually
# sent, and won't be until #replace_with is called.
def send_global_request(type, *extra, &callback)
@recordings << SendGlobalRequestRecording.new(type, extra, callback)
self
end
# Always returns +true+, so that the pending connection looks active until
# it can be truly opened and replaced with a real connection.
def busy?(include_invisible=false)
true
end
# Does nothing, except to make a pending connection quack like a real connection.
def close
self
end
# Returns an empty array, since a pending connection cannot have any real channels.
def channels
[]
end
# Returns +true+, and does nothing else.
def preprocess
true
end
# Returns +true+, and does nothing else.
def postprocess(readers, writers)
true
end
# Returns an empty hash, since a pending connection has no real listeners.
def listeners
{}
end
end
end; end; end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rubygems/util.rb
|
# frozen_string_literal: false
##
# This module contains various utility methods as module methods.
module Gem::Util
@silent_mutex = nil
##
# Zlib::GzipReader wrapper that unzips +data+.
def self.gunzip(data)
require 'zlib'
require 'stringio'
data = StringIO.new(data, 'r')
unzipped = Zlib::GzipReader.new(data).read
unzipped.force_encoding Encoding::BINARY if Object.const_defined? :Encoding
unzipped
end
##
# Zlib::GzipWriter wrapper that zips +data+.
def self.gzip(data)
require 'zlib'
require 'stringio'
zipped = StringIO.new('','w')
zipped.set_encoding Encoding::BINARY if Object.const_defined? :Encoding
Zlib::GzipWriter.wrap zipped do |io| io.write data end
zipped.string
end
##
# A Zlib::Inflate#inflate wrapper
def self.inflate(data)
require 'zlib'
Zlib::Inflate.inflate data
end
##
# This calls IO.popen where it accepts an array for a +command+ (Ruby 1.9+)
# and implements an IO.popen-like behavior where it does not accept an array
# for a command.
def self.popen *command
IO.popen command, &:read
rescue TypeError # ruby 1.8 only supports string command
r, w = IO.pipe
pid = fork do
STDIN.close
STDOUT.reopen w
exec(*command)
end
w.close
begin
return r.read
ensure
Process.wait pid
end
end
NULL_DEVICE = defined?(IO::NULL) ? IO::NULL : Gem.win_platform? ? 'NUL' : '/dev/null'
##
# Invokes system, but silences all output.
def self.silent_system *command
opt = {:out => NULL_DEVICE, :err => [:child, :out]}
if Hash === command.last
opt.update(command.last)
cmds = command[0...-1]
else
cmds = command.dup
end
return system(*(cmds << opt))
rescue TypeError
require 'thread'
@silent_mutex ||= Mutex.new
null_device = NULL_DEVICE
@silent_mutex.synchronize do
begin
stdout = STDOUT.dup
stderr = STDERR.dup
STDOUT.reopen null_device, 'w'
STDERR.reopen null_device, 'w'
return system(*command)
ensure
STDOUT.reopen stdout
STDERR.reopen stderr
stdout.close
stderr.close
end
end
end
##
# Enumerates the parents of +directory+.
def self.traverse_parents directory
return enum_for __method__, directory unless block_given?
here = File.expand_path directory
start = here
Dir.chdir start
begin
loop do
yield here
Dir.chdir '..'
return if Dir.pwd == here # toplevel
here = Dir.pwd
end
ensure
Dir.chdir start
end
end
end
|
arnab0073/idea
|
.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/executable-hooks-1.3.2/lib/executable-hooks/wrapper.rb
|
# install / uninstall wrapper
require 'fileutils'
require 'rubygems'
require 'executable-hooks/specification'
module ExecutableHooks
module Wrapper
def self.wrapper_name
'ruby_executable_hooks'
end
def self.expanded_wrapper_name
Gem.default_exec_format % self.wrapper_name
end
def self.bindir
Gem.respond_to?(:bindir,true) ? Gem.send(:bindir) : File.join(Gem.dir, 'bin')
end
def self.destination
File.expand_path( expanded_wrapper_name, bindir )
end
def self.ensure_custom_shebang
expected_shebang = "$env #{expanded_wrapper_name}"
Gem.configuration[:custom_shebang] ||= expected_shebang
if Gem.configuration[:custom_shebang] != expected_shebang
warn("
Warning:
Found custom_shebang: '#{Gem.configuration[:custom_shebang]}',
Expected custom_shebang: '#{expected_shebang}',
this can potentially break 'executable-hooks' and gem executables overall!
Check your '~/.gemrc' and '/etc/gemrc' for 'custom_shebang' and remove it.
")
end
end
def self.install
ensure_custom_shebang
executable_hooks_spec = ExecutableHooks::Specification.find
if executable_hooks_spec
install_from( executable_hooks_spec.full_gem_path )
end
end
def self.install_from(full_gem_path)
wrapper_path = File.expand_path( "bin/#{wrapper_name}", full_gem_path )
if File.exist?(wrapper_path) && !File.exist?(destination)
FileUtils.mkdir_p(bindir) unless File.exist?(bindir)
# exception based on Gem::Installer.generate_bin
raise Gem::FilePermissionError.new(bindir) unless File.writable?(bindir)
FileUtils.cp(wrapper_path, destination)
File.chmod(0775, destination)
end
end
def self.uninstall
FileUtils.rm_f(destination) if File.exist?(destination)
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tile/tspinbox.rb
|
#
# ttk::spinbox widget (Tcl/Tk 8.6b1 or later)
# by <NAME> (<EMAIL>)
#
require 'tk'
require 'tkextlib/tile.rb'
module Tk
module Tile
class TSpinbox < Tk::Tile::TEntry
end
Spinbox = TSpinbox
end
end
class Tk::Tile::TSpinbox < Tk::Tile::TEntry
include Tk::Tile::TileWidget
if Tk::Tile::USE_TTK_NAMESPACE
TkCommandNames = ['::ttk::spinbox'.freeze].freeze
else
TkCommandNames = ['::tspinbox'.freeze].freeze
end
WidgetClassName = 'TSpinbox'.freeze
WidgetClassNames[WidgetClassName] ||= self
class SpinCommand < TkValidateCommand
class ValidateArgs < TkUtil::CallbackSubst
KEY_TBL = [
[ ?d, ?s, :direction ],
[ ?s, ?e, :current ],
[ ?W, ?w, :widget ],
nil
]
PROC_TBL = [
[ ?s, TkComm.method(:string) ],
[ ?w, TkComm.method(:window) ],
[ ?e, proc{|val|
#enc = Tk.encoding
enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
if enc
Tk.fromUTF8(TkComm::string(val), enc)
else
TkComm::string(val)
end
}
],
nil
]
_setup_subst_table(KEY_TBL, PROC_TBL);
def self.ret_val(val)
(val)? '1': '0'
end
end
def self._config_keys
['command']
end
end
def __validation_class_list
super() << SpinCommand
end
Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
def __boolval_optkeys
super() << 'wrap'
end
private :__boolval_optkeys
def __strval_optkeys
super() << 'buttonbackground' << 'format'
end
private :__strval_optkeys
def __listval_optkeys
super() << 'values'
end
private :__listval_optkeys
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
def current
number(tk_send_without_enc('current'))
end
def current=(idx)
tk_send('current', idx)
end
def set(val)
tk_send('set', val)
end
alias identify ttk_identify
end
#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Spinbox, :TkSpinbox)
Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tspinbox.rb',
:Ttk, Tk::Tile::Spinbox, :TkSpinbox)
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/tile/themes/kroc.rb
|
<reponame>arnab0073/idea<filename>.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/tile/themes/kroc.rb
#
# kroc.rb
#
# based on:
# >> kroc.tcl - Copyright (C) 2004 <NAME> <<EMAIL>>
#
imgdir = File.join(File.dirname(__FILE__), 'kroc', 'kroc')
$images = Tk::Tile.load_images(imgdir, '*.gif')
if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
$TNotebook_Tab = Tk::Tile::TNotebook.style('Tab')
else
$TNotebook_Tab = 'Tab.TNotebook'
end
def kroc_rb_settings
# Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F',
# :troughcolor=>'#F8C278', :borderwidth=>1)
# or
# Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F',
# :troughcolor=>'#F8C278', :borderwidth=>1)
# or
# Tk::Tile::Style.default('.', :background=>'#FCB64F',
# :troughcolor=>'#F8C278', :borderwidth=>1)
# or
# Tk::Tile::Style.default(nil, :background=>'#FCB64F',
# :troughcolor=>'#F8C278', :borderwidth=>1)
# or
Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278',
:borderwidth=>1)
# Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default,
# :borderwidth=>1)
# or
# Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default,
# :borderwidth=>1)
# or
# Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default,
# :borderwidth=>1)
# or
# Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default,
# :borderwidth=>1)
# or
Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1)
# Tk::Tile::Style.map(TkRoot, :background=>[:active, '#694418'])
# or
# Tk::Tile::Style.map(Tk.root, :background=>[:active, '#694418'])
# or
# Tk::Tile::Style.map('.', :background=>[:active, '#694418'])
# or
# Tk::Tile::Style.map(nil, :background=>[:active, '#694418'])
# or
Tk::Tile::Style.map(:background=>[:active, '#694418'])
Tk::Tile::Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB'])
# Tk::Tile::Style.default('TButton', :padding=>[10,4])
Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4])
# Tk::Tile::Style.default('TNotebook.Tab',
Tk::Tile::Style.default($TNotebook_Tab,
:padding=>[10, 3], :font=>Tk::Tile::Font::Default)
# Tk::Tile::Style.map('TNotebook.Tab',
Tk::Tile::Style.map($TNotebook_Tab,
:background=>[:selected, '#FCB64F', '', '#FFE6BA'],
:foreground=>['', 'black'],
:padding=>[:selected, [10, 6, 10, 3]])
# Tk::Tile::Style.map('TScrollbar',
Tk::Tile::Style.map(Tk::Tile::TScrollbar,
:background=>[:pressed, '#694418'],
:arrowcolor=>[:pressed, '#FEF7CB'],
:relief=>[:pressed, :sunken])
# Tk::Tile::Style.layout('Vertical.TScrollbar',
Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar),
['Scrollbar.trough', {:children=>[
'Scrollbar.uparrow', {:side=>:top},
'Scrollbar.downarrow', {:side=>:bottom},
'Scrollbar.uparrow', {:side=>:bottom},
'Scrollbar.thumb', {:side=>:top, :expand=>true}
]}
])
# Tk::Tile::Style.layout('Horizontal.TScrollbar',
Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar),
['Scrollbar.trough', {:children=>[
'Scrollbar.leftarrow', {:side=>:left},
'Scrollbar.rightarrow', {:side=>:right},
'Scrollbar.leftarrow', {:side=>:right},
'Scrollbar.thumb', {:side=>:left, :expand=>true}
]}
])
#
# Elements:
#
if Tk::Tile::TILE_SPEC_VERSION_ID >= 8
Tk::Tile::Style.element_create('Button.button',
:image,
[ $images['button-n'],
:pressed, $images['button-p'],
:active, $images['button-h'],
], :border=>3, :sticky=>:ew)
Tk::Tile::Style.element_create('Checkbutton.indicator',
:image,
[ $images['check-nu'],
[:pressed, :selected],$images['check-nc'],
:pressed, $images['check-nu'],
[:active, :selected], $images['check-hc'],
:active, $images['check-hu'],
:selected, $images['check-nc'],
], :sticky=>:w)
Tk::Tile::Style.element_create('Radiobutton.indicator',
:image,
[ $images['radio-nu'],
[:pressed,:selected],$images['radio-nc'],
:pressed, $images['radio-nu'],
[:active,:selected], $images['radio-hc'],
:active, $images['radio-hu'],
:selected, $images['radio-nc'],
], :sticky=>:w)
elsif TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
Tk::Tile::Style.element_create('Button.button',
:image, $images['button-n'],
:map=>[
:pressed, $images['button-p'],
:active, $images['button-h'],
], :border=>3, :sticky=>:ew)
Tk::Tile::Style.element_create('Checkbutton.indicator',
:image, $images['check-nu'],
:map=>[
[:pressed, :selected],$images['check-nc'],
:pressed, $images['check-nu'],
[:active, :selected], $images['check-hc'],
:active, $images['check-hu'],
:selected, $images['check-nc'],
], :sticky=>:w)
Tk::Tile::Style.element_create('Radiobutton.indicator',
:image, $images['radio-nu'],
:map=>[
[:pressed, :selected],$images['radio-nc'],
:pressed, $images['radio-nu'],
[:active, :selected], $images['radio-hc'],
:active, $images['radio-hu'],
:selected, $images['radio-nc'],
], :sticky=>:w)
else # tile 0.4 or earlier
Tk::Tile::Style.element_create('Button.button', :pixmap,
:images=>[
:pressed, $images['button-p'],
:active, $images['button-h'],
'', $images['button-n']
], :border=>3, :tiling=>:tile)
Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap,
:images=>[
[:pressed, :selected],$images['check-nc'],
:pressed, $images['check-nu'],
[:active, :selected], $images['check-hc'],
:active, $images['check-hu'],
:selected, $images['check-nc'],
'', $images['check-nu'],
], :tiling=>:fixed)
Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap,
:images=>[
[:pressed, :selected],$images['radio-nc'],
:pressed, $images['radio-nu'],
[:active, :selected], $images['radio-hc'],
:active, $images['radio-hu'],
:selected, $images['radio-nc'],
'', $images['radio-nu'],
], :tiling=>:fixed)
end
#
# Settings:
#
# Tk::Tile::Style.layout(Tk::Tile::TButton,
Tk::Tile::Style.layout('TButton', [
'Button.button', {:children=>[
'Button.focus', {:children=>[
'Button.padding', {:children=>[
'Button.label', {:expand=>true, :sticky=>''}
]}
]}
]}
])
# Tk::Tile::Style.layout(Tk::Tile::TCheckbutton,
Tk::Tile::Style.layout('TCheckbutton', [
'Checkbutton.background', # this is not needed in tile 0.5 or later
'Checkbutton.border', {:children=>[
'Checkbutton.padding', {:children=>[
'Checkbutton.indicator', {:side=>:left},
'Checkbutton.focus', {:side=>:left, :children=>[
'Checkbutton.label'
]}
]}
]}
])
# Tk::Tile::Style.layout(Tk::Tile::TRadiobutton,
Tk::Tile::Style.layout('TRadiobutton', [
'Radiobutton.background', # this is not needed in tile 0.5 or later
'Radiobutton.border', {:children=>[
'Radiobutton.padding', {:children=>[
'Radiobutton.indicator', {:side=>:left},
'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[
'Radiobutton.label', {:side=>:right, :expand=>true}
]}
]}
]}
])
end
Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt',
:settings=>proc{ kroc_rb_settings() })
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tk/bgerror.rb
|
#
# tkbgerror -- bgerror ( tkerror ) module
# 1998/07/16 by <NAME> <<EMAIL>>
#
require 'tk'
module TkBgError
extend Tk
TkCommandNames = ['bgerror'.freeze].freeze
def bgerror(message)
tk_call('bgerror', message)
end
alias tkerror bgerror
alias show bgerror
module_function :bgerror, :tkerror, :show
def set_handler(hdlr = Proc.new) #==> handler :: proc{|msg| ...body... }
tk_call('proc', 'bgerror', 'msg', install_cmd(hdlr) + ' $msg')
end
def set_default
begin
tk_call('rename', 'bgerror', '')
rescue RuntimeError
end
end
module_function :set_handler, :set_default
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rdoc/generator/pot/po.rb
|
# frozen_string_literal: false
##
# Generates a PO format text
class RDoc::Generator::POT::PO
##
# Creates an object that represents PO format.
def initialize
@entries = {}
add_header
end
##
# Adds a PO entry to the PO.
def add entry
existing_entry = @entries[entry.msgid]
if existing_entry
entry = existing_entry.merge(entry)
end
@entries[entry.msgid] = entry
end
##
# Returns PO format text for the PO.
def to_s
po = ''
sort_entries.each do |entry|
po << "\n" unless po.empty?
po << entry.to_s
end
po
end
private
def add_header
add(header_entry)
end
def header_entry
comment = <<-COMMENT
SOME DESCRIPTIVE TITLE.
Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
This file is distributed under the same license as the PACKAGE package.
FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
COMMENT
content = <<-CONTENT
Project-Id-Version: PACKAGE VERSEION
Report-Msgid-Bugs-To:
PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE
Last-Translator: FULL NAME <EMAIL@ADDRESS>
Language-Team: LANGUAGE <<EMAIL>>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=CHARSET
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;
CONTENT
options = {
:msgstr => content,
:translator_comment => comment,
:flags => ['fuzzy'],
}
RDoc::Generator::POT::POEntry.new('', options)
end
def sort_entries
headers, messages = @entries.values.partition do |entry|
entry.msgid.empty?
end
# TODO: sort by location
sorted_messages = messages.sort_by do |entry|
entry.msgid
end
headers + sorted_messages
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/benchmark/bm_vm_thread_mutex1.rb
|
# one thread, one mutex (no contention)
require 'thread'
m = Mutex.new
r = 0
max = 2000
lmax = max * max
(1..1).map{
Thread.new{
i=0
while i<lmax
i+=1
m.synchronize{
r += 1
}
end
}
}.each{|e|
e.join
}
raise r.to_s if r != max * max
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rubygems/psych_additions.rb
|
# frozen_string_literal: false
# This exists just to satisfy bugs in marshal'd gemspecs that
# contain a reference to YAML::PrivateType. We prune these out
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
module Psych # :nodoc:
class PrivateType # :nodoc:
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/yajl-ruby-1.2.1/spec/json_gem_compatibility/compatibility_spec.rb
|
<filename>.rvm/gems/ruby-2.3.0/gems/yajl-ruby-1.2.1/spec/json_gem_compatibility/compatibility_spec.rb<gh_stars>10-100
# encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
class Dummy; end
describe "JSON Gem compatability API" do
it "shoud not mixin #to_json on base objects until compatability has been enabled" do
d = Dummy.new
d.respond_to?(:to_json).should_not be_true
"".respond_to?(:to_json).should_not be_true
1.respond_to?(:to_json).should_not be_true
"1.5".to_f.respond_to?(:to_json).should_not be_true
[].respond_to?(:to_json).should_not be_true
{:foo => "bar"}.respond_to?(:to_json).should_not be_true
true.respond_to?(:to_json).should_not be_true
false.respond_to?(:to_json).should_not be_true
nil.respond_to?(:to_json).should_not be_true
end
it "should mixin #to_json on base objects after compatability has been enabled" do
require 'yajl/json_gem'
d = Dummy.new
d.respond_to?(:to_json).should be_true
"".respond_to?(:to_json).should be_true
1.respond_to?(:to_json).should be_true
"1.5".to_f.respond_to?(:to_json).should be_true
[].respond_to?(:to_json).should be_true
{:foo => "bar"}.respond_to?(:to_json).should be_true
true.respond_to?(:to_json).should be_true
false.respond_to?(:to_json).should be_true
nil.respond_to?(:to_json).should be_true
end
it "should require yajl/json_gem to enable the compatability API" do
defined?(JSON).should be_true
JSON.respond_to?(:parse).should be_true
JSON.respond_to?(:generate).should be_true
JSON.respond_to?(:pretty_generate).should be_true
JSON.respond_to?(:load).should be_true
JSON.respond_to?(:dump).should be_true
end
it "should allow default parsing options be set with JSON.default_options" do
default = JSON.default_options[:symbolize_keys]
JSON.parse('{"foo": 1234}').should === {"foo" => 1234}
JSON.default_options[:symbolize_keys] = true
JSON.parse('{"foo": 1234}').should === {:foo => 1234}
JSON.default_options[:symbolize_keys] = default # ensure the rest of the test cases expect the default
end
it "should also allow the json gem's symbolize_names key" do
JSON.parse('{"foo": 1234}', :symbolize_names => true).should === {:foo => 1234}
end
it "should encode arbitrary classes via their default to_json method" do
d = Dummy.new
d.to_json.should == "\"#{d.to_s}\""
t = Time.now
t.to_json.should == "\"#{t.to_s}\""
da = Date.today
da.to_json.should == "\"#{da.to_s}\""
dt = DateTime.new
dt.to_json.should == "\"#{dt.to_s}\""
end
it "should have the standard parsing and encoding exceptions mapped" do
JSON::JSONError.new.is_a?(StandardError).should be_true
JSON::ParserError.new.is_a?(JSON::JSONError).should be_true
JSON::GeneratorError.new.is_a?(JSON::JSONError).should be_true
lambda {
JSON.parse("blah")
}.should raise_error(JSON::ParserError)
lambda {
JSON.generate(0.0/0.0)
}.should raise_error(JSON::GeneratorError)
end
context "ported tests for Unicode" do
it "should be able to encode and parse unicode" do
'""'.should eql(''.to_json)
'"\\b"'.should eql("\b".to_json)
'"\u0001"'.should eql(0x1.chr.to_json)
'"\u001F"'.should eql(0x1f.chr.to_json)
'" "'.should eql(' '.to_json)
"\"#{0x7f.chr}\"".should eql(0x7f.chr.to_json)
utf8 = [ "© ≠ €! \01" ]
json = "[\"© ≠ €! \\u0001\"]"
json.should eql(utf8.to_json)
utf8.should eql(JSON.parse(json))
utf8 = ["\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212"]
json = "[\"あいうえお\"]"
json.should eql(utf8.to_json)
utf8.should eql(JSON.parse(json))
utf8 = ['საქართველო']
json = "[\"საქართველო\"]"
json.should eql(utf8.to_json)
utf8.should eql(JSON.parse(json))
'["Ã"]'.should eql(JSON.generate(["Ã"]))
["€"].should eql(JSON.parse('["\u20ac"]'))
utf8_str = "\xf0\xa0\x80\x81"
utf8 = [utf8_str]
json = "[\"#{utf8_str}\"]"
json.should eql(JSON.generate(utf8))
utf8.should eql(JSON.parse(json))
end
end
context "ported tests for generation" do
before(:all) do
@hash = {
'a' => 2,
'b' => 3.141,
'c' => 'c',
'd' => [ 1, "b", 3.14 ],
'e' => { 'foo' => 'bar' },
'g' => "blah",
'h' => 1000.0,
'i' => 0.001
}
@json2 = '{"a":2,"b":3.141,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},"g":"blah","h":1000.0,"i":0.001}'
@json3 = %{
{
"a": 2,
"b": 3.141,
"c": "c",
"d": [1, "b", 3.14],
"e": {"foo": "bar"},
"g": "blah",
"h": 1000.0,
"i": 0.001
}
}.chomp
end
it "should be able to unparse" do
json = JSON.generate(@hash)
JSON.parse(@json2).should == JSON.parse(json)
parsed_json = JSON.parse(json)
@hash.should == parsed_json
json = JSON.generate({1=>2})
'{"1":2}'.should eql(json)
parsed_json = JSON.parse(json)
{"1"=>2}.should == parsed_json
end
it "should be able to unparse pretty" do
json = JSON.pretty_generate(@hash)
JSON.parse(@json3).should == JSON.parse(json)
parsed_json = JSON.parse(json)
@hash.should == parsed_json
json = JSON.pretty_generate({1=>2})
test = "{\n \"1\": 2\n}".chomp
test.should == json
parsed_json = JSON.parse(json)
{"1"=>2}.should == parsed_json
end
end
context "ported fixture tests" do
fixtures = File.join(File.dirname(__FILE__), '../parsing/fixtures/*.json')
passed, failed = Dir[fixtures].partition { |f| f['pass'] }
JSON_PASSED = passed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort
JSON_FAILED = failed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort
JSON_FAILED.each do |name, source|
it "should not be able to parse #{File.basename(name)} as an IO" do
lambda {
JSON.parse(StringIO.new(source))
}.should raise_error(JSON::ParserError)
end
end
JSON_FAILED.each do |name, source|
it "should not be able to parse #{File.basename(name)} as a string" do
lambda {
JSON.parse(source)
}.should raise_error(JSON::ParserError)
end
end
JSON_PASSED.each do |name, source|
it "should be able to parse #{File.basename(name)} as an IO" do
lambda {
JSON.parse(StringIO.new(source))
}.should_not raise_error
end
end
JSON_PASSED.each do |name, source|
it "should be able to parse #{File.basename(name)} as a string" do
lambda {
JSON.parse(source)
}.should_not raise_error
end
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tile/tnotebook.rb
|
#
# tnotebook widget
# by <NAME> (<EMAIL>)
#
require 'tk'
require 'tkextlib/tile.rb'
module Tk
module Tile
class TNotebook < TkWindow
end
Notebook = TNotebook
end
end
class Tk::Tile::TNotebook < TkWindow
################################
include TkItemConfigMethod
def __item_cget_cmd(id)
[self.path, 'tab', id]
end
private :__item_cget_cmd
def __item_config_cmd(id)
[self.path, 'tab', id]
end
private :__item_config_cmd
def __item_listval_optkeys(id)
[]
end
private :__item_listval_optkeys
def __item_methodcall_optkeys(id) # { key=>method, ... }
{}
end
private :__item_methodcall_optkeys
#alias tabcget itemcget
#alias tabcget_strict itemcget_strict
alias tabconfigure itemconfigure
alias tabconfiginfo itemconfiginfo
alias current_tabconfiginfo current_itemconfiginfo
def tabcget_tkstring(tagOrId, option)
tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{option}")), false, true)[-1]
end
def tabcget_strict(tagOrId, option)
tabconfiginfo(tagOrId, option)[-1]
end
def tabcget(tagOrId, option)
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tabcget_strict(tagOrId, option)
else
begin
tabcget_strict(tagOrId, option)
rescue => e
begin
if current_tabconfiginfo(tagOrId).has_key?(option.to_s)
# not tag error & option is known -> error on known option
fail e
else
# not tag error & option is unknown
nil
end
rescue
fail e # tag error
end
end
end
end
################################
include Tk::Tile::TileWidget
if Tk::Tile::USE_TTK_NAMESPACE
TkCommandNames = ['::ttk::notebook'.freeze].freeze
else
TkCommandNames = ['::tnotebook'.freeze].freeze
end
WidgetClassName = 'TNotebook'.freeze
WidgetClassNames[WidgetClassName] ||= self
def self.style(*args)
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
def enable_traversal()
if Tk::Tile::TILE_SPEC_VERSION_ID < 5
tk_call_without_enc('::tile::enableNotebookTraversal', @path)
elsif Tk::Tile::TILE_SPEC_VERSION_ID < 7
tk_call_without_enc('::tile::notebook::enableTraversal', @path)
else
tk_call_without_enc('::ttk::notebook::enableTraversal', @path)
end
self
end
def add(child, keys=nil)
if keys && keys != None
tk_send('add', _epath(child), *hash_kv(keys))
else
tk_send('add', _epath(child))
end
self
end
def forget(idx)
tk_send('forget', idx)
self
end
def hide(idx)
tk_send('hide', idx)
end
def index(idx)
number(tk_send('index', idx))
end
def insert(idx, subwin, keys=nil)
if keys && keys != None
tk_send('insert', idx, subwin, *hash_kv(keys))
else
tk_send('insert', idx, subwin)
end
self
end
def select(idx)
tk_send('select', idx)
self
end
def selected
window(tk_send_without_enc('select'))
end
def tabs
list(tk_send('tabs'))
end
end
#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook)
Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tnotebook.rb',
:Ttk, Tk::Tile::Notebook, :TkNotebook)
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/sample/exyacc.rb
|
<reponame>arnab0073/idea<filename>.rvm/src/ruby-1.9.3-p551/sample/exyacc.rb
#! /usr/local/bin/ruby -Kn
# usage: exyacc.rb [yaccfiles]
# this is coverted from exyacc.pl in the camel book
ARGF.each(nil) do |source|
sbeg = source.index("\n%%") + 1
send = source.rindex("\n%%") + 1
grammer = source[sbeg, send-sbeg]
grammer.sub!(/.*\n/, "")
grammer.gsub!(/'\{'/, "'\001'")
grammer.gsub!(/'\}'/, "'\002'")
grammer.gsub!(%r{\*/}, "\003\003")
grammer.gsub!(%r{/\*[^\003]*\003\003}, '')
while grammer.gsub!(/\{[^{}]*\}/, ''); end
grammer.gsub!(/'\001'/, "'{'")
grammer.gsub!(/'\002'/, "'}'")
while grammer.gsub!(/^[ \t]*\n(\s)/, '\1'); end
grammer.gsub!(/([:|])[ \t\n]+(\w)/, '\1 \2')
print grammer
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/win32ole/sample/xml.rb
|
<gh_stars>10-100
#
# This file created by olegen.rb as following.
# ruby olegen.rb 'Microsoft XML, version 2.0' > xml.rb
#
require 'win32ole'
require 'win32ole/property'
#
module IXMLDOMImplementation
include WIN32OLE::VARIANT
attr_reader :lastargs
# BOOL hasFeature
# BSTR arg0 --- feature [IN]
# BSTR arg1 --- version [IN]
def hasFeature(arg0, arg1)
ret = _invoke(145, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
end
# Core DOM node interface
module IXMLDOMNode
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
# Constants that define a node's type
module OLEtagDOMNodeType
include WIN32OLE::VARIANT
attr_reader :lastargs
NODE_INVALID = 0
NODE_ELEMENT = 1
NODE_ATTRIBUTE = 2
NODE_TEXT = 3
NODE_CDATA_SECTION = 4
NODE_ENTITY_REFERENCE = 5
NODE_ENTITY = 6
NODE_PROCESSING_INSTRUCTION = 7
NODE_COMMENT = 8
NODE_DOCUMENT = 9
NODE_DOCUMENT_TYPE = 10
NODE_DOCUMENT_FRAGMENT = 11
NODE_NOTATION = 12
end
#
module IXMLDOMNodeList
include WIN32OLE::VARIANT
attr_reader :lastargs
# I4 length
# number of nodes in the collection
def length()
ret = _getproperty(74, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# PTR item
# collection of nodes
# I4 arg0 --- index [IN]
def item
OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH])
end
# IXMLDOMNode nextNode
# get next node from iterator
def nextNode()
ret = _invoke(76, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID reset
# reset the position of iterator
def reset()
ret = _invoke(77, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMNamedNodeMap
include WIN32OLE::VARIANT
attr_reader :lastargs
# I4 length
# number of nodes in the collection
def length()
ret = _getproperty(74, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# PTR item
# collection of nodes
# I4 arg0 --- index [IN]
def item
OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH])
end
# IXMLDOMNode getNamedItem
# lookup item by name
# BSTR arg0 --- name [IN]
def getNamedItem(arg0)
ret = _invoke(83, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode setNamedItem
# set item by name
# IXMLDOMNode arg0 --- newItem [IN]
def setNamedItem(arg0)
ret = _invoke(84, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeNamedItem
# remove item by name
# BSTR arg0 --- name [IN]
def removeNamedItem(arg0)
ret = _invoke(85, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode getQualifiedItem
# lookup the item by name and namespace
# BSTR arg0 --- baseName [IN]
# BSTR arg1 --- namespaceURI [IN]
def getQualifiedItem(arg0, arg1)
ret = _invoke(87, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeQualifiedItem
# remove the item by name and namespace
# BSTR arg0 --- baseName [IN]
# BSTR arg1 --- namespaceURI [IN]
def removeQualifiedItem(arg0, arg1)
ret = _invoke(88, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextNode
# get next node from iterator
def nextNode()
ret = _invoke(89, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID reset
# reset the position of iterator
def reset()
ret = _invoke(90, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMDocument
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocumentType doctype
# node corresponding to the DOCTYPE
def doctype()
ret = _getproperty(38, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMImplementation implementation
# info on this DOM implementation
def implementation()
ret = _getproperty(39, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMElement documentElement
# the root of the tree
def documentElement()
ret = _getproperty(40, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 readyState
# get the state of the XML document
def readyState()
ret = _getproperty(-525, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMParseError parseError
# get the last parser error
def parseError()
ret = _getproperty(59, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR url
# get the URL for the loaded XML document
def url()
ret = _getproperty(60, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL async
# flag for asynchronous download
def async()
ret = _getproperty(61, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL validateOnParse
# indicates whether the parser performs validation
def validateOnParse()
ret = _getproperty(65, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL resolveExternals
# indicates whether the parser resolves references to external DTD/Entities/Schema
def resolveExternals()
ret = _getproperty(66, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL preserveWhiteSpace
# indicates whether the parser preserves whitespace
def preserveWhiteSpace()
ret = _getproperty(67, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID async
# flag for asynchronous download
def async=(arg0)
ret = _setproperty(61, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID validateOnParse
# indicates whether the parser performs validation
def validateOnParse=(arg0)
ret = _setproperty(65, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID resolveExternals
# indicates whether the parser resolves references to external DTD/Entities/Schema
def resolveExternals=(arg0)
ret = _setproperty(66, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID preserveWhiteSpace
# indicates whether the parser preserves whitespace
def preserveWhiteSpace=(arg0)
ret = _setproperty(67, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID onreadystatechange
# register a readystatechange event handler
def onreadystatechange=(arg0)
ret = _setproperty(68, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID ondataavailable
# register an ondataavailable event handler
def ondataavailable=(arg0)
ret = _setproperty(69, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID ontransformnode
# register an ontransformnode event handler
def ontransformnode=(arg0)
ret = _setproperty(70, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMElement createElement
# create an Element node
# BSTR arg0 --- tagName [IN]
def createElement(arg0)
ret = _invoke(41, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocumentFragment createDocumentFragment
# create a DocumentFragment node
def createDocumentFragment()
ret = _invoke(42, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMText createTextNode
# create a text node
# BSTR arg0 --- data [IN]
def createTextNode(arg0)
ret = _invoke(43, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMComment createComment
# create a comment node
# BSTR arg0 --- data [IN]
def createComment(arg0)
ret = _invoke(44, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMCDATASection createCDATASection
# create a CDATA section node
# BSTR arg0 --- data [IN]
def createCDATASection(arg0)
ret = _invoke(45, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMProcessingInstruction createProcessingInstruction
# create a processing instruction node
# BSTR arg0 --- target [IN]
# BSTR arg1 --- data [IN]
def createProcessingInstruction(arg0, arg1)
ret = _invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMAttribute createAttribute
# create an attribute node
# BSTR arg0 --- name [IN]
def createAttribute(arg0)
ret = _invoke(47, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMEntityReference createEntityReference
# create an entity reference node
# BSTR arg0 --- name [IN]
def createEntityReference(arg0)
ret = _invoke(49, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList getElementsByTagName
# build a list of elements by name
# BSTR arg0 --- tagName [IN]
def getElementsByTagName(arg0)
ret = _invoke(50, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode createNode
# create a node of the specified node type and name
# VARIANT arg0 --- type [IN]
# BSTR arg1 --- name [IN]
# BSTR arg2 --- namespaceURI [IN]
def createNode(arg0, arg1, arg2)
ret = _invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nodeFromID
# retrieve node from it's ID
# BSTR arg0 --- idString [IN]
def nodeFromID(arg0)
ret = _invoke(56, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL load
# load document from the specified XML source
# VARIANT arg0 --- xmlSource [IN]
def load(arg0)
ret = _invoke(58, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID abort
# abort an asynchronous download
def abort()
ret = _invoke(62, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL loadXML
# load the document from a string
# BSTR arg0 --- bstrXML [IN]
def loadXML(arg0)
ret = _invoke(63, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID save
# save the document to a specified desination
# VARIANT arg0 --- desination [IN]
def save(arg0)
ret = _invoke(64, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMDocumentType
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR name
# name of the document type (root of the tree)
def name()
ret = _getproperty(131, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap entities
# a list of entities in the document
def entities()
ret = _getproperty(132, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap notations
# a list of notations in the document
def notations()
ret = _getproperty(133, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMElement
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR tagName
# get the tagName of the element
def tagName()
ret = _getproperty(97, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT getAttribute
# look up the string value of an attribute by name
# BSTR arg0 --- name [IN]
def getAttribute(arg0)
ret = _invoke(99, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID setAttribute
# set the string value of an attribute by name
# BSTR arg0 --- name [IN]
# VARIANT arg1 --- value [IN]
def setAttribute(arg0, arg1)
ret = _invoke(100, [arg0, arg1], [VT_BSTR, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID removeAttribute
# remove an attribute by name
# BSTR arg0 --- name [IN]
def removeAttribute(arg0)
ret = _invoke(101, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMAttribute getAttributeNode
# look up the attribute node by name
# BSTR arg0 --- name [IN]
def getAttributeNode(arg0)
ret = _invoke(102, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMAttribute setAttributeNode
# set the specified attribute on the element
# IXMLDOMAttribute arg0 --- DOMAttribute [IN]
def setAttributeNode(arg0)
ret = _invoke(103, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMAttribute removeAttributeNode
# remove the specified attribute
# IXMLDOMAttribute arg0 --- DOMAttribute [IN]
def removeAttributeNode(arg0)
ret = _invoke(104, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList getElementsByTagName
# build a list of elements by name
# BSTR arg0 --- tagName [IN]
def getElementsByTagName(arg0)
ret = _invoke(105, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID normalize
# collapse all adjacent text nodes in sub-tree
def normalize()
ret = _invoke(106, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMAttribute
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR name
# get name of the attribute
def name()
ret = _getproperty(118, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT value
# string value of the attribute
def value()
ret = _getproperty(120, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID value
# string value of the attribute
def value=(arg0)
ret = _setproperty(120, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMDocumentFragment
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMText
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR data
# value of the node
def data()
ret = _getproperty(109, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 length
# number of characters in value
def length()
ret = _getproperty(110, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID data
# value of the node
def data=(arg0)
ret = _setproperty(109, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR substringData
# retrieve substring of value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def substringData(arg0, arg1)
ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID appendData
# append string to value
# BSTR arg0 --- data [IN]
def appendData(arg0)
ret = _invoke(112, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID insertData
# insert string into value
# I4 arg0 --- offset [IN]
# BSTR arg1 --- data [IN]
def insertData(arg0, arg1)
ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID deleteData
# delete string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def deleteData(arg0, arg1)
ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID replaceData
# replace string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
# BSTR arg2 --- data [IN]
def replaceData(arg0, arg1, arg2)
ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMText splitText
# split the text node into two text nodes at the position specified
# I4 arg0 --- offset [IN]
def splitText(arg0)
ret = _invoke(123, [arg0], [VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMCharacterData
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR data
# value of the node
def data()
ret = _getproperty(109, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 length
# number of characters in value
def length()
ret = _getproperty(110, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID data
# value of the node
def data=(arg0)
ret = _setproperty(109, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR substringData
# retrieve substring of value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def substringData(arg0, arg1)
ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID appendData
# append string to value
# BSTR arg0 --- data [IN]
def appendData(arg0)
ret = _invoke(112, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID insertData
# insert string into value
# I4 arg0 --- offset [IN]
# BSTR arg1 --- data [IN]
def insertData(arg0, arg1)
ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID deleteData
# delete string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def deleteData(arg0, arg1)
ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID replaceData
# replace string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
# BSTR arg2 --- data [IN]
def replaceData(arg0, arg1, arg2)
ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMComment
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR data
# value of the node
def data()
ret = _getproperty(109, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 length
# number of characters in value
def length()
ret = _getproperty(110, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID data
# value of the node
def data=(arg0)
ret = _setproperty(109, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR substringData
# retrieve substring of value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def substringData(arg0, arg1)
ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID appendData
# append string to value
# BSTR arg0 --- data [IN]
def appendData(arg0)
ret = _invoke(112, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID insertData
# insert string into value
# I4 arg0 --- offset [IN]
# BSTR arg1 --- data [IN]
def insertData(arg0, arg1)
ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID deleteData
# delete string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def deleteData(arg0, arg1)
ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID replaceData
# replace string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
# BSTR arg2 --- data [IN]
def replaceData(arg0, arg1, arg2)
ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMCDATASection
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR data
# value of the node
def data()
ret = _getproperty(109, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 length
# number of characters in value
def length()
ret = _getproperty(110, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID data
# value of the node
def data=(arg0)
ret = _setproperty(109, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR substringData
# retrieve substring of value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def substringData(arg0, arg1)
ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID appendData
# append string to value
# BSTR arg0 --- data [IN]
def appendData(arg0)
ret = _invoke(112, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID insertData
# insert string into value
# I4 arg0 --- offset [IN]
# BSTR arg1 --- data [IN]
def insertData(arg0, arg1)
ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID deleteData
# delete string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
def deleteData(arg0, arg1)
ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID replaceData
# replace string within the value
# I4 arg0 --- offset [IN]
# I4 arg1 --- count [IN]
# BSTR arg2 --- data [IN]
def replaceData(arg0, arg1, arg2)
ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMText splitText
# split the text node into two text nodes at the position specified
# I4 arg0 --- offset [IN]
def splitText(arg0)
ret = _invoke(123, [arg0], [VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMProcessingInstruction
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR target
# the target
def target()
ret = _getproperty(127, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR data
# the data
def data()
ret = _getproperty(128, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID data
# the data
def data=(arg0)
ret = _setproperty(128, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMEntityReference
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
# structure for reporting parser errors
module IXMLDOMParseError
include WIN32OLE::VARIANT
attr_reader :lastargs
# I4 errorCode
# the error code
def errorCode()
ret = _getproperty(0, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR url
# the URL of the XML document containing the error
def url()
ret = _getproperty(179, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR reason
# the cause of the error
def reason()
ret = _getproperty(180, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR srcText
# the data where the error occurred
def srcText()
ret = _getproperty(181, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 line
# the line number in the XML document where the error occurred
def line()
ret = _getproperty(182, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 linepos
# the character position in the line containing the error
def linepos()
ret = _getproperty(183, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 filepos
# the absolute file position in the XML document containing the error
def filepos()
ret = _getproperty(184, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMNotation
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT publicId
# the public ID
def publicId()
ret = _getproperty(136, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT systemId
# the system ID
def systemId()
ret = _getproperty(137, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
#
module IXMLDOMEntity
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT publicId
# the public ID
def publicId()
ret = _getproperty(140, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT systemId
# the system ID
def systemId()
ret = _getproperty(141, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR notationName
# the name of the notation
def notationName()
ret = _getproperty(142, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
# XTL runtime object
module IXTLRuntime
include WIN32OLE::VARIANT
attr_reader :lastargs
# BSTR nodeName
# name of the node
def nodeName()
ret = _getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = _getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = _getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = _getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = _getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = _getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = _getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = _getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = _getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = _getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = _getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = _getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = _getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = _getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = _getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = _getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = _setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = _setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = _setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = _setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = _invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = _invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = _invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = _invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 uniqueID
# IXMLDOMNode arg0 --- pNode [IN]
def uniqueID(arg0)
ret = _invoke(187, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 depth
# IXMLDOMNode arg0 --- pNode [IN]
def depth(arg0)
ret = _invoke(188, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 childNumber
# IXMLDOMNode arg0 --- pNode [IN]
def childNumber(arg0)
ret = _invoke(189, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 ancestorChildNumber
# BSTR arg0 --- bstrNodeName [IN]
# IXMLDOMNode arg1 --- pNode [IN]
def ancestorChildNumber(arg0, arg1)
ret = _invoke(190, [arg0, arg1], [VT_BSTR, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 absoluteChildNumber
# IXMLDOMNode arg0 --- pNode [IN]
def absoluteChildNumber(arg0)
ret = _invoke(191, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR formatIndex
# I4 arg0 --- lIndex [IN]
# BSTR arg1 --- bstrFormat [IN]
def formatIndex(arg0, arg1)
ret = _invoke(192, [arg0, arg1], [VT_I4, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR formatNumber
# R8 arg0 --- dblNumber [IN]
# BSTR arg1 --- bstrFormat [IN]
def formatNumber(arg0, arg1)
ret = _invoke(193, [arg0, arg1], [VT_R8, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR formatDate
# VARIANT arg0 --- varDate [IN]
# BSTR arg1 --- bstrFormat [IN]
# VARIANT arg2 --- varDestLocale [IN]
def formatDate(arg0, arg1, arg2=nil)
ret = _invoke(194, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR formatTime
# VARIANT arg0 --- varTime [IN]
# BSTR arg1 --- bstrFormat [IN]
# VARIANT arg2 --- varDestLocale [IN]
def formatTime(arg0, arg1, arg2=nil)
ret = _invoke(195, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
end
# W3C-DOM XML Document
class Microsoft_XMLDOM_1_0 # DOMDocument
include WIN32OLE::VARIANT
attr_reader :lastargs
attr_reader :dispatch
attr_reader :clsid
attr_reader :progid
def initialize(obj = nil)
@clsid = "{2933BF90-7B36-11D2-B20E-00C04F983E60}"
@progid = "Microsoft.XMLDOM.1.0"
if obj.nil?
@dispatch = WIN32OLE.new(@progid)
else
@dispatch = obj
end
end
def method_missing(cmd, *arg)
@dispatch.method_missing(cmd, *arg)
end
# BSTR nodeName
# name of the node
def nodeName()
ret = @dispatch._getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = @dispatch._getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = @dispatch._getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = @dispatch._getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = @dispatch._getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = @dispatch._getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = @dispatch._getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = @dispatch._getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = @dispatch._getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = @dispatch._getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = @dispatch._getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = @dispatch._getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = @dispatch._getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = @dispatch._getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = @dispatch._getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = @dispatch._getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = @dispatch._getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = @dispatch._getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = @dispatch._getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = @dispatch._getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = @dispatch._getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = @dispatch._getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocumentType doctype
# node corresponding to the DOCTYPE
def doctype()
ret = @dispatch._getproperty(38, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMImplementation implementation
# info on this DOM implementation
def implementation()
ret = @dispatch._getproperty(39, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMElement documentElement
# the root of the tree
def documentElement()
ret = @dispatch._getproperty(40, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 readyState
# get the state of the XML document
def readyState()
ret = @dispatch._getproperty(-525, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMParseError parseError
# get the last parser error
def parseError()
ret = @dispatch._getproperty(59, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR url
# get the URL for the loaded XML document
def url()
ret = @dispatch._getproperty(60, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL async
# flag for asynchronous download
def async()
ret = @dispatch._getproperty(61, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL validateOnParse
# indicates whether the parser performs validation
def validateOnParse()
ret = @dispatch._getproperty(65, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL resolveExternals
# indicates whether the parser resolves references to external DTD/Entities/Schema
def resolveExternals()
ret = @dispatch._getproperty(66, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL preserveWhiteSpace
# indicates whether the parser preserves whitespace
def preserveWhiteSpace()
ret = @dispatch._getproperty(67, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = @dispatch._setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID async
# flag for asynchronous download
def async=(arg0)
ret = @dispatch._setproperty(61, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID validateOnParse
# indicates whether the parser performs validation
def validateOnParse=(arg0)
ret = @dispatch._setproperty(65, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID resolveExternals
# indicates whether the parser resolves references to external DTD/Entities/Schema
def resolveExternals=(arg0)
ret = @dispatch._setproperty(66, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID preserveWhiteSpace
# indicates whether the parser preserves whitespace
def preserveWhiteSpace=(arg0)
ret = @dispatch._setproperty(67, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID onreadystatechange
# register a readystatechange event handler
def onreadystatechange=(arg0)
ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID ondataavailable
# register an ondataavailable event handler
def ondataavailable=(arg0)
ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID ontransformnode
# register an ontransformnode event handler
def ontransformnode=(arg0)
ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = @dispatch._invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = @dispatch._invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = @dispatch._invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = @dispatch._invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMElement createElement
# create an Element node
# BSTR arg0 --- tagName [IN]
def createElement(arg0)
ret = @dispatch._invoke(41, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocumentFragment createDocumentFragment
# create a DocumentFragment node
def createDocumentFragment()
ret = @dispatch._invoke(42, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMText createTextNode
# create a text node
# BSTR arg0 --- data [IN]
def createTextNode(arg0)
ret = @dispatch._invoke(43, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMComment createComment
# create a comment node
# BSTR arg0 --- data [IN]
def createComment(arg0)
ret = @dispatch._invoke(44, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMCDATASection createCDATASection
# create a CDATA section node
# BSTR arg0 --- data [IN]
def createCDATASection(arg0)
ret = @dispatch._invoke(45, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMProcessingInstruction createProcessingInstruction
# create a processing instruction node
# BSTR arg0 --- target [IN]
# BSTR arg1 --- data [IN]
def createProcessingInstruction(arg0, arg1)
ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMAttribute createAttribute
# create an attribute node
# BSTR arg0 --- name [IN]
def createAttribute(arg0)
ret = @dispatch._invoke(47, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMEntityReference createEntityReference
# create an entity reference node
# BSTR arg0 --- name [IN]
def createEntityReference(arg0)
ret = @dispatch._invoke(49, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList getElementsByTagName
# build a list of elements by name
# BSTR arg0 --- tagName [IN]
def getElementsByTagName(arg0)
ret = @dispatch._invoke(50, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode createNode
# create a node of the specified node type and name
# VARIANT arg0 --- type [IN]
# BSTR arg1 --- name [IN]
# BSTR arg2 --- namespaceURI [IN]
def createNode(arg0, arg1, arg2)
ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nodeFromID
# retrieve node from it's ID
# BSTR arg0 --- idString [IN]
def nodeFromID(arg0)
ret = @dispatch._invoke(56, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL load
# load document from the specified XML source
# VARIANT arg0 --- xmlSource [IN]
def load(arg0)
ret = @dispatch._invoke(58, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID abort
# abort an asynchronous download
def abort()
ret = @dispatch._invoke(62, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL loadXML
# load the document from a string
# BSTR arg0 --- bstrXML [IN]
def loadXML(arg0)
ret = @dispatch._invoke(63, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID save
# save the document to a specified desination
# VARIANT arg0 --- desination [IN]
def save(arg0)
ret = @dispatch._invoke(64, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT ondataavailable EVENT in XMLDOMDocumentEvents
def ondataavailable()
ret = @dispatch._invoke(198, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents
def onreadystatechange()
ret = @dispatch._invoke(-609, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
# W3C-DOM XML Document (Apartment)
class Microsoft_FreeThreadedXMLDOM_1_0 # DOMFreeThreadedDocument
include WIN32OLE::VARIANT
attr_reader :lastargs
attr_reader :dispatch
attr_reader :clsid
attr_reader :progid
def initialize(obj = nil)
@clsid = "{2933BF91-7B36-11D2-B20E-00C04F983E60}"
@progid = "Microsoft.FreeThreadedXMLDOM.1.0"
if obj.nil?
@dispatch = WIN32OLE.new(@progid)
else
@dispatch = obj
end
end
def method_missing(cmd, *arg)
@dispatch.method_missing(cmd, *arg)
end
# BSTR nodeName
# name of the node
def nodeName()
ret = @dispatch._getproperty(2, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeValue
# value stored in the node
def nodeValue()
ret = @dispatch._getproperty(3, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DOMNodeType nodeType
# the node's type
def nodeType()
ret = @dispatch._getproperty(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode parentNode
# parent of the node
def parentNode()
ret = @dispatch._getproperty(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList childNodes
# the collection of the node's children
def childNodes()
ret = @dispatch._getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode firstChild
# first child of the node
def firstChild()
ret = @dispatch._getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode lastChild
# first child of the node
def lastChild()
ret = @dispatch._getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode previousSibling
# left sibling of the node
def previousSibling()
ret = @dispatch._getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nextSibling
# right sibling of the node
def nextSibling()
ret = @dispatch._getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNamedNodeMap attributes
# the collection of the node's attributes
def attributes()
ret = @dispatch._getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocument ownerDocument
# document that contains the node
def ownerDocument()
ret = @dispatch._getproperty(18, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR nodeTypeString
# the type of node in string form
def nodeTypeString()
ret = @dispatch._getproperty(21, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR text
# text content of the node and subtree
def text()
ret = @dispatch._getproperty(24, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL specified
# indicates whether node is a default value
def specified()
ret = @dispatch._getproperty(22, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode definition
# pointer to the definition of the node in the DTD or schema
def definition()
ret = @dispatch._getproperty(23, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue()
ret = @dispatch._getproperty(25, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT dataType
# the data type of the node
def dataType()
ret = @dispatch._getproperty(26, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR xml
# return the XML source for the node and each of its descendants
def xml()
ret = @dispatch._getproperty(27, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL parsed
# has sub-tree been completely parsed
def parsed()
ret = @dispatch._getproperty(31, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR namespaceURI
# the URI for the namespace applying to the node
def namespaceURI()
ret = @dispatch._getproperty(32, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR prefix
# the prefix for the namespace applying to the node
def prefix()
ret = @dispatch._getproperty(33, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR baseName
# the base name of the node (nodename with the prefix stripped off)
def baseName()
ret = @dispatch._getproperty(34, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocumentType doctype
# node corresponding to the DOCTYPE
def doctype()
ret = @dispatch._getproperty(38, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMImplementation implementation
# info on this DOM implementation
def implementation()
ret = @dispatch._getproperty(39, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMElement documentElement
# the root of the tree
def documentElement()
ret = @dispatch._getproperty(40, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 readyState
# get the state of the XML document
def readyState()
ret = @dispatch._getproperty(-525, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMParseError parseError
# get the last parser error
def parseError()
ret = @dispatch._getproperty(59, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR url
# get the URL for the loaded XML document
def url()
ret = @dispatch._getproperty(60, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL async
# flag for asynchronous download
def async()
ret = @dispatch._getproperty(61, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL validateOnParse
# indicates whether the parser performs validation
def validateOnParse()
ret = @dispatch._getproperty(65, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL resolveExternals
# indicates whether the parser resolves references to external DTD/Entities/Schema
def resolveExternals()
ret = @dispatch._getproperty(66, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL preserveWhiteSpace
# indicates whether the parser preserves whitespace
def preserveWhiteSpace()
ret = @dispatch._getproperty(67, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeValue
# value stored in the node
def nodeValue=(arg0)
ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID text
# text content of the node and subtree
def text=(arg0)
ret = @dispatch._setproperty(24, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID nodeTypedValue
# get the strongly typed value of the node
def nodeTypedValue=(arg0)
ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID dataType
# the data type of the node
def dataType=(arg0)
ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID async
# flag for asynchronous download
def async=(arg0)
ret = @dispatch._setproperty(61, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID validateOnParse
# indicates whether the parser performs validation
def validateOnParse=(arg0)
ret = @dispatch._setproperty(65, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID resolveExternals
# indicates whether the parser resolves references to external DTD/Entities/Schema
def resolveExternals=(arg0)
ret = @dispatch._setproperty(66, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID preserveWhiteSpace
# indicates whether the parser preserves whitespace
def preserveWhiteSpace=(arg0)
ret = @dispatch._setproperty(67, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID onreadystatechange
# register a readystatechange event handler
def onreadystatechange=(arg0)
ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID ondataavailable
# register an ondataavailable event handler
def ondataavailable=(arg0)
ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID ontransformnode
# register an ontransformnode event handler
def ontransformnode=(arg0)
ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode insertBefore
# insert a child node
# IXMLDOMNode arg0 --- newChild [IN]
# VARIANT arg1 --- refChild [IN]
def insertBefore(arg0, arg1)
ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode replaceChild
# replace a child node
# IXMLDOMNode arg0 --- newChild [IN]
# IXMLDOMNode arg1 --- oldChild [IN]
def replaceChild(arg0, arg1)
ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode removeChild
# remove a child node
# IXMLDOMNode arg0 --- childNode [IN]
def removeChild(arg0)
ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode appendChild
# append a child node
# IXMLDOMNode arg0 --- newChild [IN]
def appendChild(arg0)
ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL hasChildNodes
def hasChildNodes()
ret = @dispatch._invoke(17, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode cloneNode
# BOOL arg0 --- deep [IN]
def cloneNode(arg0)
ret = @dispatch._invoke(19, [arg0], [VT_BOOL])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR transformNode
# apply the stylesheet to the subtree
# IXMLDOMNode arg0 --- stylesheet [IN]
def transformNode(arg0)
ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList selectNodes
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectNodes(arg0)
ret = @dispatch._invoke(29, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode selectSingleNode
# execute query on the subtree
# BSTR arg0 --- queryString [IN]
def selectSingleNode(arg0)
ret = @dispatch._invoke(30, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID transformNodeToObject
# apply the stylesheet to the subtree, returning the result through a document or a stream
# IXMLDOMNode arg0 --- stylesheet [IN]
# VARIANT arg1 --- outputObject [IN]
def transformNodeToObject(arg0, arg1)
ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMElement createElement
# create an Element node
# BSTR arg0 --- tagName [IN]
def createElement(arg0)
ret = @dispatch._invoke(41, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMDocumentFragment createDocumentFragment
# create a DocumentFragment node
def createDocumentFragment()
ret = @dispatch._invoke(42, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMText createTextNode
# create a text node
# BSTR arg0 --- data [IN]
def createTextNode(arg0)
ret = @dispatch._invoke(43, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMComment createComment
# create a comment node
# BSTR arg0 --- data [IN]
def createComment(arg0)
ret = @dispatch._invoke(44, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMCDATASection createCDATASection
# create a CDATA section node
# BSTR arg0 --- data [IN]
def createCDATASection(arg0)
ret = @dispatch._invoke(45, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMProcessingInstruction createProcessingInstruction
# create a processing instruction node
# BSTR arg0 --- target [IN]
# BSTR arg1 --- data [IN]
def createProcessingInstruction(arg0, arg1)
ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMAttribute createAttribute
# create an attribute node
# BSTR arg0 --- name [IN]
def createAttribute(arg0)
ret = @dispatch._invoke(47, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMEntityReference createEntityReference
# create an entity reference node
# BSTR arg0 --- name [IN]
def createEntityReference(arg0)
ret = @dispatch._invoke(49, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNodeList getElementsByTagName
# build a list of elements by name
# BSTR arg0 --- tagName [IN]
def getElementsByTagName(arg0)
ret = @dispatch._invoke(50, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode createNode
# create a node of the specified node type and name
# VARIANT arg0 --- type [IN]
# BSTR arg1 --- name [IN]
# BSTR arg2 --- namespaceURI [IN]
def createNode(arg0, arg1, arg2)
ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# IXMLDOMNode nodeFromID
# retrieve node from it's ID
# BSTR arg0 --- idString [IN]
def nodeFromID(arg0)
ret = @dispatch._invoke(56, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL load
# load document from the specified XML source
# VARIANT arg0 --- xmlSource [IN]
def load(arg0)
ret = @dispatch._invoke(58, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID abort
# abort an asynchronous download
def abort()
ret = @dispatch._invoke(62, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BOOL loadXML
# load the document from a string
# BSTR arg0 --- bstrXML [IN]
def loadXML(arg0)
ret = @dispatch._invoke(63, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID save
# save the document to a specified desination
# VARIANT arg0 --- desination [IN]
def save(arg0)
ret = @dispatch._invoke(64, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT ondataavailable EVENT in XMLDOMDocumentEvents
def ondataavailable()
ret = @dispatch._invoke(198, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents
def onreadystatechange()
ret = @dispatch._invoke(-609, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
# IXMLHttpRequest Interface
module IXMLHttpRequest
include WIN32OLE::VARIANT
attr_reader :lastargs
# I4 status
# Get HTTP status code
def status()
ret = _getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR statusText
# Get HTTP status text
def statusText()
ret = _getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DISPATCH responseXML
# Get response body
def responseXML()
ret = _getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR responseText
# Get response body
def responseText()
ret = _getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT responseBody
# Get response body
def responseBody()
ret = _getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT responseStream
# Get response body
def responseStream()
ret = _getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 readyState
# Get ready state
def readyState()
ret = _getproperty(13, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID onreadystatechange
# Register a complete event handler
def onreadystatechange=(arg0)
ret = _setproperty(14, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID open
# Open HTTP connection
# BSTR arg0 --- bstrMethod [IN]
# BSTR arg1 --- bstrUrl [IN]
# VARIANT arg2 --- varAsync [IN]
# VARIANT arg3 --- bstrUser [IN]
# VARIANT arg4 --- bstrPassword [IN]
def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil)
ret = _invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID setRequestHeader
# Add HTTP request header
# BSTR arg0 --- bstrHeader [IN]
# BSTR arg1 --- bstrValue [IN]
def setRequestHeader(arg0, arg1)
ret = _invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR getResponseHeader
# Get HTTP response header
# BSTR arg0 --- bstrHeader [IN]
def getResponseHeader(arg0)
ret = _invoke(3, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR getAllResponseHeaders
# Get all HTTP response headers
def getAllResponseHeaders()
ret = _invoke(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID send
# Send HTTP request
# VARIANT arg0 --- varBody [IN]
def send(arg0=nil)
ret = _invoke(5, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID abort
# Abort HTTP request
def abort()
ret = _invoke(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
# XML HTTP Request class.
class Microsoft_XMLHTTP_1 # XMLHTTPRequest
include WIN32OLE::VARIANT
attr_reader :lastargs
attr_reader :dispatch
attr_reader :clsid
attr_reader :progid
def initialize(obj = nil)
@clsid = "{ED8C108E-4349-11D2-91A4-00C04F7969E8}"
@progid = "Microsoft.XMLHTTP.1"
if obj.nil?
@dispatch = WIN32OLE.new(@progid)
else
@dispatch = obj
end
end
def method_missing(cmd, *arg)
@dispatch.method_missing(cmd, *arg)
end
# I4 status
# Get HTTP status code
def status()
ret = @dispatch._getproperty(7, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR statusText
# Get HTTP status text
def statusText()
ret = @dispatch._getproperty(8, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# DISPATCH responseXML
# Get response body
def responseXML()
ret = @dispatch._getproperty(9, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR responseText
# Get response body
def responseText()
ret = @dispatch._getproperty(10, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT responseBody
# Get response body
def responseBody()
ret = @dispatch._getproperty(11, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VARIANT responseStream
# Get response body
def responseStream()
ret = @dispatch._getproperty(12, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 readyState
# Get ready state
def readyState()
ret = @dispatch._getproperty(13, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID onreadystatechange
# Register a complete event handler
def onreadystatechange=(arg0)
ret = @dispatch._setproperty(14, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID open
# Open HTTP connection
# BSTR arg0 --- bstrMethod [IN]
# BSTR arg1 --- bstrUrl [IN]
# VARIANT arg2 --- varAsync [IN]
# VARIANT arg3 --- bstrUser [IN]
# VARIANT arg4 --- bstrPassword [IN]
def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil)
ret = @dispatch._invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID setRequestHeader
# Add HTTP request header
# BSTR arg0 --- bstrHeader [IN]
# BSTR arg1 --- bstrValue [IN]
def setRequestHeader(arg0, arg1)
ret = @dispatch._invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR getResponseHeader
# Get HTTP response header
# BSTR arg0 --- bstrHeader [IN]
def getResponseHeader(arg0)
ret = @dispatch._invoke(3, [arg0], [VT_BSTR])
@lastargs = WIN32OLE::ARGV
ret
end
# BSTR getAllResponseHeaders
# Get all HTTP response headers
def getAllResponseHeaders()
ret = @dispatch._invoke(4, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID send
# Send HTTP request
# VARIANT arg0 --- varBody [IN]
def send(arg0=nil)
ret = @dispatch._invoke(5, [arg0], [VT_VARIANT])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID abort
# Abort HTTP request
def abort()
ret = @dispatch._invoke(6, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
end
# XML Data Source Object
class Microsoft_XMLDSO_1_0 # XMLDSOControl
include WIN32OLE::VARIANT
attr_reader :lastargs
attr_reader :dispatch
attr_reader :clsid
attr_reader :progid
def initialize(obj = nil)
@clsid = "{550DDA30-0541-11D2-9CA9-0060B0EC3D39}"
@progid = "Microsoft.XMLDSO.1.0"
if obj.nil?
@dispatch = WIN32OLE.new(@progid)
else
@dispatch = obj
end
end
def method_missing(cmd, *arg)
@dispatch.method_missing(cmd, *arg)
end
# IXMLDOMDocument XMLDocument
def XMLDocument()
ret = @dispatch._getproperty(65537, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 JavaDSOCompatible
def JavaDSOCompatible()
ret = @dispatch._getproperty(65538, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# I4 readyState
def readyState()
ret = @dispatch._getproperty(-525, [], [])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID XMLDocument
def XMLDocument=(arg0)
ret = @dispatch._setproperty(65537, [arg0], [VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
# VOID JavaDSOCompatible
def JavaDSOCompatible=(arg0)
ret = @dispatch._setproperty(65538, [arg0], [VT_I4])
@lastargs = WIN32OLE::ARGV
ret
end
end
# Constants that define types for IXMLElement.
module OLEtagXMLEMEM_TYPE
include WIN32OLE::VARIANT
attr_reader :lastargs
XMLELEMTYPE_ELEMENT = 0
XMLELEMTYPE_TEXT = 1
XMLELEMTYPE_COMMENT = 2
XMLELEMTYPE_DOCUMENT = 3
XMLELEMTYPE_DTD = 4
XMLELEMTYPE_PI = 5
XMLELEMTYPE_OTHER = 6
end
# XMLDocument extends IXML Document. It is obsolete. You should use DOMDocument. This object should not be confused with the XMLDocument property on the XML data island.
class Msxml # XMLDocument
include WIN32OLE::VARIANT
attr_reader :lastargs
attr_reader :dispatch
attr_reader :clsid
attr_reader :progid
def initialize(obj = nil)
@clsid = "{CFC399AF-D876-11D0-9C10-00C04FC99C8E}"
@progid = "Msxml"
if obj.nil?
@dispatch = WIN32OLE.new(@progid)
else
@dispatch = obj
end
end
def method_missing(cmd, *arg)
@dispatch.method_missing(cmd, *arg)
end
# HRESULT url
# set URL to load an XML document from the URL.
# BSTR arg0 --- p [IN]
def url=(arg0)
ret = @dispatch._setproperty(65641, [arg0], [VT_BSTR, VT_HRESULT])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT charset
# get encoding.
# BSTR arg0 --- p [IN]
def charset=(arg0)
ret = @dispatch._setproperty(65645, [arg0], [VT_BSTR, VT_HRESULT])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT async
# get asynchronous loading flag.
# BOOL arg0 --- pf [IN]
def async=(arg0)
ret = @dispatch._setproperty(65649, [arg0], [VT_BOOL, VT_HRESULT])
@lastargs = WIN32OLE::ARGV
ret
end
# HRESULT root
# get root IXMLElement of the XML document.
# IXMLElement2,IXMLElement2 arg0 --- p [OUT]
def root
OLEProperty.new(@dispatch, 65637, [VT_BYREF|VT_BYREF|VT_DISPATCH], [VT_BYREF|VT_BYREF|VT_DISPATCH, VT_HRESULT])
end
# HRESULT url
# set URL to load an XML document from the URL.
# BSTR arg0 --- p [OUT]
def url
OLEProperty.new(@dispatch, 65641, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
end
# HRESULT readyState
# get ready state.
# I4 arg0 --- pl [OUT]
def readyState
OLEProperty.new(@dispatch, 65643, [VT_BYREF|VT_I4], [VT_BYREF|VT_I4, VT_HRESULT])
end
# HRESULT charset
# get encoding.
# BSTR arg0 --- p [OUT]
def charset
OLEProperty.new(@dispatch, 65645, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
end
# HRESULT version
# get XML version number.
# BSTR arg0 --- p [OUT]
def version
OLEProperty.new(@dispatch, 65646, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
end
# HRESULT doctype
# get document type.
# BSTR arg0 --- p [OUT]
def doctype
OLEProperty.new(@dispatch, 65647, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
end
# HRESULT async
# get asynchronous loading flag.
# BOOL arg0 --- pf [OUT]
def async
OLEProperty.new(@dispatch, 65649, [VT_BYREF|VT_BOOL], [VT_BYREF|VT_BOOL, VT_HRESULT])
end
# HRESULT createElement
# create different types of IXMLElements.
# VARIANT arg0 --- vType [IN]
# VARIANT arg1 --- var1 [IN]
# IXMLElement2,IXMLElement2 arg2 --- ppElem [OUT]
def createElement(arg0, arg1=nil, arg2=nil)
ret = @dispatch._invoke(65644, [arg0, arg1, arg2], [VT_VARIANT, VT_VARIANT, VT_BYREF|VT_BYREF|VT_DISPATCH])
@lastargs = WIN32OLE::ARGV
ret
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/bootstraptest/test_literal.rb
|
<filename>.rvm/src/ruby-1.9.3-p551/bootstraptest/test_literal.rb
# empty program
assert_equal '', ''
assert_equal '', ' '
assert_equal '', "\n"
# special const
assert_equal 'true', 'true'
assert_equal 'TrueClass', 'true.class'
assert_equal 'false', 'false'
assert_equal 'FalseClass', 'false.class'
assert_equal '', 'nil'
assert_equal 'nil', 'nil.inspect'
assert_equal 'NilClass', 'nil.class'
assert_equal 'sym', ':sym'
assert_equal ':sym', ':sym.inspect'
assert_equal 'Symbol', ':sym.class'
assert_equal '1234', '1234'
assert_equal 'Fixnum', '1234.class'
assert_equal '1234', '1_2_3_4'
assert_equal 'Fixnum', '1_2_3_4.class'
assert_equal '18', '0x12'
assert_equal 'Fixnum', '0x12.class'
assert_equal '15', '0o17'
assert_equal 'Fixnum', '0o17.class'
assert_equal '5', '0b101'
assert_equal 'Fixnum', '0b101.class'
assert_equal '123456789012345678901234567890', '123456789012345678901234567890'
assert_equal 'Bignum', '123456789012345678901234567890.class'
assert_equal '2.0', '2.0'
assert_equal 'Float', '1.3.class'
# self
assert_equal 'main', 'self'
assert_equal 'Object', 'self.class'
# string literal
assert_equal 'a', '?a'
assert_equal 'String', '?a.class'
assert_equal 'A', '?A'
assert_equal 'String', '?A.class'
assert_equal "\n", '?\n'
assert_equal 'String', '?\n.class'
assert_equal ' ', '?\ '
assert_equal 'String', '?\ .class'
assert_equal 'string', "'string'"
assert_equal 'string', '"string"'
assert_equal 'string', '%(string)'
assert_equal 'string', '%q(string)'
assert_equal 'string', '%Q(string)'
assert_equal 'string string', '"string string"'
assert_equal ' ', '" "'
assert_equal "\0", '"\0"'
assert_equal "\1", '"\1"'
assert_equal "3", '"\x33"'
assert_equal "\n", '"\n"'
# dynamic string literal
assert_equal '2', '"#{1 + 1}"'
assert_equal '16', '"#{2 ** 4}"'
assert_equal 'string', 's = "string"; "#{s}"'
# dynamic symbol literal
assert_equal 'a3c', ':"a#{1+2}c"'
assert_equal ':a3c', ':"a#{1+2}c".inspect'
assert_equal 'Symbol', ':"a#{1+2}c".class'
# xstring
assert_equal "foo\n", %q(`echo foo`)
assert_equal "foo\n", %q(s = "foo"; `echo #{s}`)
# regexp
assert_equal '', '//.source'
assert_equal 'Regexp', '//.class'
assert_equal '0', '// =~ "a"'
assert_equal '0', '// =~ ""'
assert_equal 'a', '/a/.source'
assert_equal 'Regexp', '/a/.class'
assert_equal '0', '/a/ =~ "a"'
assert_equal '0', '/test/ =~ "test"'
assert_equal '', '/test/ =~ "tes"'
assert_equal '0', 're = /test/; re =~ "test"'
assert_equal '0', 'str = "test"; /test/ =~ str'
assert_equal '0', 're = /test/; str = "test"; re =~ str'
# dynacmi regexp
assert_equal 'regexp', %q(/re#{'ge'}xp/.source)
assert_equal 'Regexp', %q(/re#{'ge'}xp/.class)
# array
assert_equal 'Array', '[].class'
assert_equal '0', '[].size'
assert_equal '0', '[].length'
assert_equal '[]', '[].inspect'
assert_equal 'Array', '[0].class'
assert_equal '1', '[3].size'
assert_equal '[3]', '[3].inspect'
assert_equal '3', 'a = [3]; a[0]'
assert_equal 'Array', '[1,2].class'
assert_equal '2', '[1,2].size'
assert_equal '[1, 2]', '[1,2].inspect'
assert_equal 'Array', '[1,2,3,4,5].class'
assert_equal '5', '[1,2,3,4,5].size'
assert_equal '[1, 2, 3, 4, 5]', '[1,2,3,4,5].inspect'
assert_equal '1', 'a = [1,2]; a[0]'
assert_equal '2', 'a = [1,2]; a[1]'
assert_equal 'Array', 'a = [1 + 2, 3 + 4, 5 + 6]; a.class'
assert_equal '[3, 7, 11]', 'a = [1 + 2, 3 + 4, 5 + 6]; a.inspect'
assert_equal '7', 'a = [1 + 2, 3 + 4, 5 + 6]; a[1]'
assert_equal '1', '([0][0] += 1)'
assert_equal '1', '([2][0] -= 1)'
assert_equal 'Array', 'a = [obj = Object.new]; a.class'
assert_equal '1', 'a = [obj = Object.new]; a.size'
assert_equal 'true', 'a = [obj = Object.new]; a[0] == obj'
assert_equal '5', 'a = [1,2,3]; a[1] = 5; a[1]'
assert_equal 'bar', '[*:foo];:bar'
assert_equal '[1, 2]', 'def nil.to_a; [2]; end; [1, *nil]'
assert_equal '[1, 2]', 'def nil.to_a; [1, 2]; end; [*nil]'
assert_equal '[0, 1, {2=>3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"
# hash
assert_equal 'Hash', '{}.class'
assert_equal '{}', '{}.inspect'
assert_equal 'Hash', '{1=>2}.class'
assert_equal '{1=>2}', '{1=>2}.inspect'
assert_equal '2', 'h = {1 => 2}; h[1]'
assert_equal '0', 'h = {1 => 2}; h.delete(1); h.size'
assert_equal '', 'h = {1 => 2}; h.delete(1); h[1]'
assert_equal '2', 'h = {"string" => "literal", "goto" => "hell"}; h.size'
assert_equal 'literal', 'h = {"string"=>"literal", "goto"=>"hell"}; h["string"]'
assert_equal 'hell', 'h = {"string"=>"literal", "goto"=>"hell"}; h["goto"]'
# range
assert_equal 'Range', '(1..2).class'
assert_equal '1..2', '(1..2).inspect'
assert_equal '1', '(1..2).begin'
assert_equal '2', '(1..2).end'
assert_equal 'false', '(1..2).exclude_end?'
assert_equal 'Range', 'r = 1..2; r.class'
assert_equal '1..2', 'r = 1..2; r.inspect'
assert_equal '1', 'r = 1..2; r.begin'
assert_equal '2', 'r = 1..2; r.end'
assert_equal 'false', 'r = 1..2; r.exclude_end?'
assert_equal 'Range', '(1...3).class'
assert_equal '1...3', '(1...3).inspect'
assert_equal '1', '(1...3).begin'
assert_equal '3', '(1...3).end'
assert_equal 'true', '(1...3).exclude_end?'
assert_equal 'Range', 'r = (1...3); r.class'
assert_equal '1...3', 'r = (1...3); r.inspect'
assert_equal '1', 'r = (1...3); r.begin'
assert_equal '3', 'r = (1...3); r.end'
assert_equal 'true', 'r = (1...3); r.exclude_end?'
assert_equal 'Range', 'r = (1+2 .. 3+4); r.class'
assert_equal '3..7', 'r = (1+2 .. 3+4); r.inspect'
assert_equal '3', 'r = (1+2 .. 3+4); r.begin'
assert_equal '7', 'r = (1+2 .. 3+4); r.end'
assert_equal 'false', 'r = (1+2 .. 3+4); r.exclude_end?'
assert_equal 'Range', 'r = (1+2 ... 3+4); r.class'
assert_equal '3...7', 'r = (1+2 ... 3+4); r.inspect'
assert_equal '3', 'r = (1+2 ... 3+4); r.begin'
assert_equal '7', 'r = (1+2 ... 3+4); r.end'
assert_equal 'true', 'r = (1+2 ... 3+4); r.exclude_end?'
assert_equal 'Range', 'r = ("a".."c"); r.class'
assert_equal '"a".."c"', 'r = ("a".."c"); r.inspect'
assert_equal 'a', 'r = ("a".."c"); r.begin'
assert_equal 'c', 'r = ("a".."c"); r.end'
assert_equal 'String', '__FILE__.class'
assert_equal 'Fixnum', '__LINE__.class'
###
assert_equal 'ok', %q{
# this cause "called on terminated object".
ObjectSpace.each_object(Module) {|m| m.name.inspect }
:ok
}
assert_normal_exit %q{
begin
r = 0**-1
r + r
rescue
end
}, '[ruby-dev:34524]'
assert_normal_exit %q{
begin
r = Marshal.load("\x04\bU:\rRational[\ai\x06i\x05")
r + r
rescue
end
}, '[ruby-dev:34536]'
assert_equal 'ok', %q{
"#{}""#{}ok"
}, '[ruby-dev:38968]'
assert_equal 'ok', %q{
"#{}o""#{}k""#{}"
}, '[ruby-core:25284]'
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/pathname/extconf.rb
|
<reponame>arnab0073/idea
require 'mkmf'
create_makefile('pathname')
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/gyoku-1.3.1/lib/gyoku.rb
|
<reponame>arnab0073/idea<gh_stars>100-1000
require "gyoku/version"
require "gyoku/hash"
module Gyoku
# Converts a given Hash +key+ with +options+ into an XML tag.
def self.xml_tag(key, options = {})
XMLKey.create(key, options)
end
# Translates a given +hash+ with +options+ to XML.
def self.xml(hash, options = {})
Hash.to_xml hash.dup, options
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/-ext-/num2int/test_num2int.rb
|
<reponame>arnab0073/idea
# frozen_string_literal: false
require 'test/unit'
require '-test-/num2int/num2int'
class TestNum2int < Test::Unit::TestCase
SHRT_MIN = -32768
SHRT_MAX = 32767
USHRT_MAX = 65535
INT_MIN = -2147483648
INT_MAX = 2147483647
UINT_MAX = 4294967295
case [0].pack('L!').size
when 4
LONG_MAX = 2147483647
LONG_MIN = -2147483648
ULONG_MAX = 4294967295
when 8
LONG_MAX = 9223372036854775807
LONG_MIN = -9223372036854775808
ULONG_MAX = 18446744073709551615
end
LLONG_MAX = 9223372036854775807
LLONG_MIN = -9223372036854775808
ULLONG_MAX = 18446744073709551615
FIXNUM_MAX = LONG_MAX/2
FIXNUM_MIN = LONG_MIN/2
def fix2big(n)
10000000000000000000000000000.coerce(n)[0]
end
def assert_num2i_success_internal(exp, func, arg)
mesg = "#{func}(#{arg.inspect})"
out = nil
assert_nothing_raised(mesg) {
out = Num2int.send(func, arg)
}
assert_equal(exp, out, mesg)
end
def assert_num2i_success(type, num, result=num)
func = "NUM2#{type}".upcase
assert_num2i_success_internal(result.to_s, func, num)
assert_num2i_success_internal(result.to_s, func, fix2big(num))
assert_num2i_success_internal(result.to_s, func, Rational(num, 1))
if num.to_f.to_i == num
assert_num2i_success_internal(result.to_s, func, num.to_f)
end
# The conversion functions such as NUM2INT uses (conceptually) to_int.
if (arg = num.to_f + 0.5) != num.to_f && arg.to_int == num
assert_num2i_success_internal(result.to_s, func, arg)
end
if (arg = num.to_f - 0.5) != num.to_f && arg.to_int == num
assert_num2i_success_internal(result.to_s, func, arg)
end
if (arg = num + Rational(1,2)) && arg.to_int == num
assert_num2i_success_internal(result.to_s, func, arg)
end
if (arg = num - Rational(1,2)) && arg.to_int == num
assert_num2i_success_internal(result.to_s, func, arg)
end
end
def assert_num2i_error_internal(func, arg)
assert_raise(RangeError, "#{func}(#{arg.inspect})") {
Num2int.send(func, arg)
}
end
def assert_num2i_error(type, num)
func = "NUM2#{type}".upcase
assert_num2i_error_internal(func, num)
assert_num2i_error_internal(func, fix2big(num))
assert_num2i_error_internal(func, Rational(num, 1))
if num.to_f.to_i == num
assert_num2i_error_internal(func, num.to_f)
end
# The conversion functions such as NUM2INT uses (conceptually) to_int.
if (arg = num.to_f + 0.5) != num.to_f && arg.to_int == num
assert_num2i_error_internal(func, arg)
end
if (arg = num.to_f - 0.5) != num.to_f && arg.to_int == num
assert_num2i_error_internal(func, arg)
end
if (arg = num + Rational(1,2)) && arg.to_int == num
assert_num2i_error_internal(func, arg)
end
if (arg = num - Rational(1,2)) && arg.to_int == num
assert_num2i_error_internal(func, arg)
end
end
def assert_fix2i_success_internal(exp, func, arg)
mesg = "#{func}(#{arg.inspect})"
out = nil
assert_nothing_raised(mesg) {
out = Num2int.send(func, arg)
}
assert_equal(exp, out, mesg)
end
def assert_fix2i_success(type, num, result=num)
return if !num.kind_of?(Fixnum)
func = "FIX2#{type}".upcase
assert_fix2i_success_internal(result.to_s, func, num)
end
def assert_fix2i_error_internal(func, arg)
assert_raise(RangeError, "#{func}(#{arg.inspect})") {
Num2int.send(func, arg)
}
end
def assert_fix2i_error(type, num)
return if !num.kind_of?(Fixnum)
func = "FIX2#{type}".upcase
assert_num2i_error_internal(func, num)
end
def test_num2short
assert_num2i_success(:short, SHRT_MIN)
assert_num2i_success(:short, SHRT_MIN+1)
assert_num2i_success(:short, SHRT_MAX)
assert_num2i_error(:short, SHRT_MIN-1)
assert_num2i_error(:short, SHRT_MAX+1)
end
def test_num2ushort
assert_num2i_success(:ushort, 0)
assert_num2i_success(:ushort, USHRT_MAX)
assert_num2i_success(:ushort, -1, USHRT_MAX)
assert_num2i_success(:ushort, SHRT_MIN, SHRT_MAX+1)
assert_num2i_success(:ushort, SHRT_MIN+1, SHRT_MAX+2)
assert_num2i_error(:ushort, SHRT_MIN-1)
assert_num2i_error(:ushort, USHRT_MAX+1)
end
def test_num2int
assert_num2i_success(:int, INT_MIN)
assert_num2i_success(:int, INT_MIN+1)
assert_num2i_success(:int, INT_MAX)
assert_num2i_error(:int, INT_MIN-1)
assert_num2i_error(:int, INT_MAX+1)
end
def test_num2uint
assert_num2i_success(:uint, 0)
assert_num2i_success(:uint, UINT_MAX)
assert_num2i_success(:uint, -1, UINT_MAX)
assert_num2i_success(:uint, INT_MIN, INT_MAX+1)
assert_num2i_success(:uint, INT_MIN+1, INT_MAX+2)
assert_num2i_error(:uint, INT_MIN-1)
assert_num2i_error(:uint, UINT_MAX+1)
end
def test_num2long
assert_num2i_success(:long, LONG_MIN)
assert_num2i_success(:long, LONG_MIN+1)
assert_num2i_success(:long, LONG_MAX)
assert_num2i_error(:long, LONG_MIN-1)
assert_num2i_error(:long, LONG_MAX+1)
assert_num2i_success(:long, FIXNUM_MIN)
assert_num2i_success(:long, FIXNUM_MIN+1)
assert_num2i_success(:long, FIXNUM_MIN-1)
assert_num2i_success(:long, FIXNUM_MAX)
assert_num2i_success(:long, FIXNUM_MAX+1)
end
def test_num2ulong
assert_num2i_success(:ulong, 0)
assert_num2i_success(:ulong, ULONG_MAX)
assert_num2i_success(:ulong, -1, ULONG_MAX)
assert_num2i_success(:ulong, LONG_MIN, LONG_MAX+1)
assert_num2i_success(:ulong, LONG_MIN+1, LONG_MAX+2)
assert_num2i_error(:ulong, LONG_MIN-1)
assert_num2i_error(:ulong, ULONG_MAX+1)
assert_num2i_success(:ulong, FIXNUM_MIN, ULONG_MAX-FIXNUM_MAX)
assert_num2i_success(:ulong, FIXNUM_MIN+1, ULONG_MAX-FIXNUM_MAX+1)
assert_num2i_success(:ulong, FIXNUM_MIN-1, ULONG_MAX-FIXNUM_MAX-1)
assert_num2i_success(:ulong, FIXNUM_MAX, FIXNUM_MAX)
assert_num2i_success(:ulong, FIXNUM_MAX+1, FIXNUM_MAX+1)
end
def test_num2ll
assert_num2i_success(:ll, LLONG_MIN)
assert_num2i_success(:ll, LLONG_MIN+1)
assert_num2i_success(:ll, LLONG_MAX)
assert_num2i_error(:ll, LLONG_MIN-1)
assert_num2i_error(:ll, LLONG_MAX+1)
assert_num2i_success(:ll, FIXNUM_MIN)
assert_num2i_success(:ll, FIXNUM_MIN+1)
assert_num2i_success(:ll, FIXNUM_MIN-1)
assert_num2i_success(:ll, FIXNUM_MAX)
assert_num2i_success(:ll, FIXNUM_MAX+1)
end if defined?(Num2int.NUM2LL)
def test_num2ull
assert_num2i_success(:ull, 0)
assert_num2i_success(:ull, ULLONG_MAX)
assert_num2i_success(:ull, -1, ULLONG_MAX)
assert_num2i_success(:ull, LLONG_MIN, LLONG_MAX+1)
assert_num2i_success(:ull, LLONG_MIN+1, LLONG_MAX+2)
assert_num2i_error(:ull, LLONG_MIN-1)
assert_num2i_error(:ull, ULLONG_MAX+1)
assert_num2i_success(:ull, FIXNUM_MIN, ULLONG_MAX-FIXNUM_MAX)
assert_num2i_success(:ull, FIXNUM_MIN+1, ULLONG_MAX-FIXNUM_MAX+1)
assert_num2i_success(:ull, FIXNUM_MIN-1, ULLONG_MAX-FIXNUM_MAX-1)
assert_num2i_success(:ull, FIXNUM_MAX)
assert_num2i_success(:ull, FIXNUM_MAX+1)
end if defined?(Num2int.NUM2ULL)
def test_fix2short
assert_fix2i_success(:short, 0)
assert_fix2i_success(:short, SHRT_MAX)
assert_fix2i_success(:short, SHRT_MIN)
assert_fix2i_success(:short, SHRT_MIN+1)
assert_fix2i_error(:short, SHRT_MAX+1)
assert_fix2i_error(:short, SHRT_MIN-1)
assert_fix2i_error(:short, FIXNUM_MAX)
assert_fix2i_error(:short, FIXNUM_MIN)
assert_fix2i_error(:short, FIXNUM_MIN+1)
end
def test_fix2int
assert_fix2i_success(:int, 0)
assert_fix2i_success(:int, INT_MAX)
assert_fix2i_success(:int, INT_MIN)
assert_fix2i_success(:int, INT_MIN+1)
assert_fix2i_error(:int, INT_MAX+1)
assert_fix2i_error(:int, INT_MIN-1)
assert_fix2i_error(:int, FIXNUM_MAX) if INT_MAX < FIXNUM_MAX
assert_fix2i_error(:int, FIXNUM_MIN) if FIXNUM_MIN < INT_MIN
assert_fix2i_error(:int, FIXNUM_MIN+1) if FIXNUM_MIN+1 < INT_MIN
end
def test_fix2uint
assert_fix2i_success(:uint, 0)
assert_fix2i_success(:uint, UINT_MAX)
assert_fix2i_success(:uint, INT_MAX)
assert_fix2i_success(:uint, INT_MIN, INT_MAX+1)
assert_fix2i_success(:uint, INT_MIN+1, INT_MAX+2)
assert_fix2i_error(:uint, UINT_MAX+1)
assert_fix2i_error(:uint, INT_MIN-1)
assert_fix2i_error(:uint, FIXNUM_MAX) if UINT_MAX < FIXNUM_MAX
assert_fix2i_error(:uint, FIXNUM_MIN) if FIXNUM_MIN < INT_MIN
assert_fix2i_error(:uint, FIXNUM_MIN+1) if FIXNUM_MIN+1 < INT_MIN
end
def test_fix2long
assert_fix2i_success(:long, 0)
assert_fix2i_success(:long, FIXNUM_MAX)
assert_fix2i_success(:long, FIXNUM_MIN)
assert_fix2i_success(:long, FIXNUM_MIN+1)
end
def test_fix2ulong
assert_fix2i_success(:ulong, 0)
assert_fix2i_success(:ulong, FIXNUM_MAX)
assert_fix2i_success(:ulong, -1, ULONG_MAX)
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/benchmark/bm_vm2_array.rb
|
i=0
while i<6_000_000 # benchmark loop 2
i+=1
a = [1,2,3,4,5,6,7,8,9,10]
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/ext/psych/lib/psych/handlers/recorder.rb
|
# frozen_string_literal: false
require 'psych/handler'
module Psych
module Handlers
###
# This handler will capture an event and record the event. Recorder events
# are available vial Psych::Handlers::Recorder#events.
#
# For example:
#
# recorder = Psych::Handlers::Recorder.new
# parser = Psych::Parser.new recorder
# parser.parse '--- foo'
#
# recorder.events # => [list of events]
#
# # Replay the events
#
# emitter = Psych::Emitter.new $stdout
# recorder.events.each do |m, args|
# emitter.send m, *args
# end
class Recorder < Psych::Handler
attr_reader :events
def initialize
@events = []
super
end
EVENTS.each do |event|
define_method event do |*args|
@events << [event, args]
end
end
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/net-ssh-2.2.2/lib/net/ssh/transport/kex.rb
|
<gh_stars>10-100
require 'net/ssh/transport/kex/diffie_hellman_group1_sha1'
require 'net/ssh/transport/kex/diffie_hellman_group_exchange_sha1'
module Net::SSH::Transport
module Kex
# Maps the supported key-exchange algorithms as named by the SSH protocol
# to their corresponding implementors.
MAP = {
'diffie-hellman-group-exchange-sha1' => DiffieHellmanGroupExchangeSHA1,
'diffie-hellman-group1-sha1' => DiffieHellmanGroup1SHA1
}
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/fiddle/extconf.rb
|
require 'mkmf'
# :stopdoc:
dir_config 'libffi'
pkg_config("libffi")
unless have_header('ffi.h')
if have_header('ffi/ffi.h')
$defs.push(format('-DUSE_HEADER_HACKS'))
else
raise "ffi.h is missing. Please install libffi."
end
end
unless have_library('ffi') || have_library('libffi')
raise "libffi is missing. Please install libffi."
end
have_header 'sys/mman.h'
if have_header "dlfcn.h"
have_library "dl"
%w{ dlopen dlclose dlsym }.each do |func|
abort "missing function #{func}" unless have_func(func)
end
have_func "dlerror"
elsif have_header "windows.h"
%w{ LoadLibrary FreeLibrary GetProcAddress }.each do |func|
abort "missing function #{func}" unless have_func(func)
end
end
have_const('FFI_STDCALL', 'ffi.h') || have_const('FFI_STDCALL', 'ffi/ffi.h')
config = File.read(RbConfig.expand(File.join($arch_hdrdir, "ruby/config.h")))
types = {"SIZE_T"=>"SSIZE_T", "PTRDIFF_T"=>nil, "INTPTR_T"=>nil}
types.each do |type, signed|
if /^\#define\s+SIZEOF_#{type}\s+(SIZEOF_(.+)|\d+)/ =~ config
if size = $2 and size != 'VOIDP'
size = types.fetch(size) {size}
$defs << format("-DTYPE_%s=TYPE_%s", signed||type, size)
end
if signed
check_signedness(type.downcase, "stddef.h")
end
end
end
create_makefile 'fiddle'
# :startdoc:
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/ohai-6.18.0/spec/spec_helper.rb
|
require 'rspec'
$:.unshift(File.expand_path("../..", __FILE__))
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'spec/support/platform_helpers'
require 'ohai'
Ohai::Config[:log_level] = :error
def it_should_check_from(plugin, attribute, from, value)
it "should set the #{attribute} to the value from '#{from}'" do
@ohai._require_plugin(plugin)
@ohai[attribute].should == value
end
end
def it_should_check_from_mash(plugin, attribute, from, value)
it "should get the #{plugin}[:#{attribute}] value from '#{from}'" do
@ohai.should_receive(:from).with(from).and_return(value)
@ohai._require_plugin(plugin)
end
it "should set the #{plugin}[:#{attribute}] to the value from '#{from}'" do
@ohai._require_plugin(plugin)
@ohai[plugin][attribute].should == value
end
end
# the mash variable may be an array listing multiple levels of Mash hierarchy
def it_should_check_from_deep_mash(plugin, mash, attribute, from, value)
it "should get the #{mash.inspect}[:#{attribute}] value from '#{from}'" do
@ohai.should_receive(:from).with(from).and_return(value)
@ohai._require_plugin(plugin)
end
it "should set the #{mash.inspect}[:#{attribute}] to the value from '#{from}'" do
@ohai._require_plugin(plugin)
if mash.is_a?(String)
@ohai[mash][attribute].should == value
elsif mash.is_a?(Array)
if mash.length == 2
@ohai[mash[0]][mash[1]][attribute].should == value
elsif mash.length == 3
@ohai[mash[0]][mash[1]][mash[2]][attribute].should == value
else
return nil
end
else
return nil
end
end
end
module SimpleFromFile
def from_file(filename)
self.instance_eval(IO.read(filename), filename, 1)
end
end
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run_excluding :windows_only => true unless windows?
config.filter_run_excluding :unix_only => true unless unix?
config.filter_run_excluding :ruby_18_only => true unless ruby_18?
config.filter_run_excluding :ruby_19_only => true unless ruby_19?
config.filter_run_excluding :requires_root => true unless ENV['USER'] == 'root'
config.filter_run_excluding :requires_unprivileged_user => true if ENV['USER'] == 'root'
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/net-ssh-multi-1.2.0/lib/net/ssh/multi/channel_proxy.rb
|
module Net; module SSH; module Multi
# The ChannelProxy is a delegate class that represents a channel that has
# not yet been opened. It is only used when Net::SSH::Multi is running with
# with a concurrent connections limit (see Net::SSH::Multi::Session#concurrent_connections).
#
# You'll never need to instantiate one of these directly, and will probably
# (if all goes well!) never even notice when one of these is in use. Essentially,
# it is spawned by a Net::SSH::Multi::PendingConnection when the pending
# connection is asked to open a channel. Any actions performed on the
# channel proxy will then be recorded, until a real channel is set as the
# delegate (see #delegate_to). At that point, all recorded actions will be
# replayed on the channel, and any subsequent actions will be immediately
# delegated to the channel.
class ChannelProxy
# This is the "on confirm" callback that gets called when the real channel
# is opened.
attr_reader :on_confirm
# Instantiates a new channel proxy with the given +on_confirm+ callback.
def initialize(&on_confirm)
@on_confirm = on_confirm
@recordings = []
@channel = nil
end
# Instructs the proxy to delegate all further actions to the given +channel+
# (which must be an instance of Net::SSH::Connection::Channel). All recorded
# actions are immediately replayed, in order, against the delegate channel.
def delegate_to(channel)
@channel = channel
@recordings.each do |sym, args, block|
@channel.__send__(sym, *args, &block)
end
end
# If a channel delegate has been specified (see #delegate_to), the method
# will be immediately sent to the delegate. Otherwise, the call is added
# to the list of recorded method calls, to be played back when a delegate
# is specified.
def method_missing(sym, *args, &block)
if @channel
@channel.__send__(sym, *args, &block)
else
@recordings << [sym, args, block]
end
end
end
end; end; end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/net-ssh-2.6.8/test/test_known_hosts.rb
|
require 'common'
class TestKnownHosts < Test::Unit::TestCase
def test_key_for_when_all_hosts_are_recognized
source = File.join(File.dirname(__FILE__),"known_hosts/github")
kh = Net::SSH::KnownHosts.new(source)
keys = kh.keys_for("github.com")
assert_equal(1, keys.count)
assert_equal("ssh-rsa", keys[0].ssh_type)
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/xenserver/requests/compute/create_network.rb
|
<gh_stars>1-10
module Fog
module Compute
class XenServer
class Real
# Create a Network
#
# @see http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=network
#
def create_network( name, config = {} )
if name.is_a?(Hash)
default_config = name
default_config.reject! { |_k,v| v.nil? }
else
Fog::Logger.deprecation(
'This api is deprecated. The only expected param is a hash with the attributes.'
)
config.reject! { |k,v| v.nil? }
default_config = {
:name_label => name,
# Description is mandatory in XenAPI but we default to empty
:name_description => config[:description] || '',
# Mandatory, but can be empty
:other_config => {}
}.merge config
end
@connection.request(
{
:parser => Fog::Parsers::XenServer::Base.new,
:method => 'network.create'
},
default_config
)
end
end
class Mock
def create_network( name, description = '', config = {} )
Fog::Mock.not_implemented
end
end
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/google/dns.rb
|
<filename>.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/google/dns.rb
require 'fog/google/core'
module Fog
module DNS
class Google < Fog::Service
requires :google_project
recognizes :app_name, :app_version, :google_client_email, :google_key_location, :google_key_string,
:google_client, :google_json_key_location, :google_json_key_string
GOOGLE_DNS_API_VERSION = 'v1beta1'
GOOGLE_DNS_BASE_URL = 'https://www.googleapis.com/dns/'
GOOGLE_DNS_API_SCOPE_URLS = %w(https://www.googleapis.com/auth/ndev.clouddns.readwrite)
##
# MODELS
model_path 'fog/google/models/dns'
# Zone
model :zone
collection :zones
# Record
model :record
collection :records
# Change
model :change
collection :changes
# Project
model :project
collection :projects
##
# REQUESTS
request_path 'fog/google/requests/dns'
# Zone
request :create_managed_zone
request :delete_managed_zone
request :get_managed_zone
request :list_managed_zones
# Record
request :list_resource_record_sets
# Change
request :create_change
request :get_change
request :list_changes
# Project
request :get_project
class Mock
include Fog::Google::Shared
def initialize(options)
shared_initialize(options[:google_project], GOOGLE_DNS_API_VERSION, GOOGLE_DNS_BASE_URL)
end
def self.data(api_version)
@data ||= {}
end
def self.reset
@data = nil
end
def data(project=@project)
self.class.data(api_version)[project] ||= {
:managed_zones => {},
:resource_record_sets => {},
:changes => {},
}
end
def reset_data
self.class.data(api_version).delete(@project)
end
end
class Real
include Fog::Google::Shared
attr_accessor :client
attr_reader :dns
def initialize(options)
shared_initialize(options[:google_project], GOOGLE_DNS_API_VERSION, GOOGLE_DNS_BASE_URL)
options.merge!(:google_api_scope_url => GOOGLE_DNS_API_SCOPE_URLS.join(' '))
@client = initialize_google_client(options)
@dns = @client.discovered_api('dns', api_version)
end
end
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/rubyntlm-0.6.0/lib/net/ntlm/channel_binding.rb
|
<filename>.rvm/gems/ruby-2.3.0/gems/rubyntlm-0.6.0/lib/net/ntlm/channel_binding.rb
module Net
module NTLM
class ChannelBinding
# Creates a ChannelBinding used for Extended Protection Authentication
# @see http://blogs.msdn.com/b/openspecification/archive/2013/03/26/ntlm-and-channel-binding-hash-aka-exteneded-protection-for-authentication.aspx
#
# @param outer_channel [OpenSSL::X509::Certificate] Server certificate securing
# the outer TLS channel
# @return [NTLM::ChannelBinding] A ChannelBinding holding a token that can be
# embedded in a {Type3} message
def self.create(outer_channel)
new(outer_channel)
end
# @param outer_channel [OpenSSL::X509::Certificate] Server certificate securing
# the outer TLS channel
def initialize(outer_channel)
@channel = outer_channel
@unique_prefix = 'tls-server-end-point'
@initiator_addtype = 0
@initiator_address_length = 0
@acceptor_addrtype = 0
@acceptor_address_length = 0
end
attr_reader :channel, :unique_prefix, :initiator_addtype
attr_reader :initiator_address_length, :acceptor_addrtype
attr_reader :acceptor_address_length
# Returns a channel binding hash acceptable for use as a AV_PAIR MsvAvChannelBindings
# field value as specified in the NTLM protocol
#
# @return [String] MD5 hash of gss_channel_bindings_struct
def channel_binding_token
@channel_binding_token ||= OpenSSL::Digest::MD5.new(gss_channel_bindings_struct).digest
end
def gss_channel_bindings_struct
@gss_channel_bindings_struct ||= begin
token = [initiator_addtype].pack('I')
token << [initiator_address_length].pack('I')
token << [acceptor_addrtype].pack('I')
token << [acceptor_address_length].pack('I')
token << [application_data.length].pack('I')
token << application_data
token
end
end
def channel_hash
@channel_hash ||= OpenSSL::Digest::SHA256.new(channel.to_der)
end
def application_data
@application_data ||= begin
data = unique_prefix
data << ':'
data << channel_hash.digest
data
end
end
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/rubygems/test_gem_util.rb
|
# frozen_string_literal: false
require 'rubygems/test_case'
require 'rubygems/util'
class TestGemUtil < Gem::TestCase
def test_class_popen
assert_equal "0\n", Gem::Util.popen(Gem.ruby, '-e', 'p 0')
assert_raises Errno::ECHILD do
Process.wait(-1)
end
end
def test_silent_system
assert_silent do
Gem::Util.silent_system Gem.ruby, '-e', 'puts "hello"; warn "hello"'
end
end
def test_traverse_parents
FileUtils.mkdir_p 'a/b/c'
enum = Gem::Util.traverse_parents 'a/b/c'
assert_equal File.join(@tempdir, 'a/b/c'), enum.next
assert_equal File.join(@tempdir, 'a/b'), enum.next
assert_equal File.join(@tempdir, 'a'), enum.next
end
def test_linked_list_find
list = [1,2,3,4,5].inject(Gem::List.new(0)) { |m,o|
Gem::List.new o, m
}
assert_equal 5, list.find { |x| x == 5 }
assert_equal 4, list.find { |x| x == 4 }
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/specifications/mime-types-1.19.gemspec
|
<reponame>arnab0073/idea
# -*- encoding: utf-8 -*-
# stub: mime-types 1.19 ruby lib
Gem::Specification.new do |s|
s.name = "mime-types"
s.version = "1.19"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["<NAME>"]
s.date = "2012-06-21"
s.description = "This library allows for the identification of a file's likely MIME content\ntype. This is release 1.19 with new MIME types. The identification of MIME\ncontent type is based on a file's filename extensions.\n\nMIME::Types for Ruby was originally based on and synchronized with MIME::Types\nfor Perl by <NAME>, copyright 2001 - 2009. As of version 1.15, the data\nformat for the MIME::Type list has changed and the synchronization will no\nlonger happen.\n\n:include: Licence.rdoc"
s.email = ["<EMAIL>"]
s.extra_rdoc_files = ["History.rdoc", "Licence.rdoc", "Manifest.txt", "README.rdoc"]
s.files = ["History.rdoc", "Licence.rdoc", "Manifest.txt", "README.rdoc"]
s.homepage = "http://mime-types.rubyforge.org/"
s.rdoc_options = ["--main", "README.rdoc"]
s.rubyforge_project = "mime-types"
s.rubygems_version = "2.5.1"
s.summary = "This library allows for the identification of a file's likely MIME content type"
s.installed_by_version = "2.5.1" if s.respond_to? :installed_by_version
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
s.add_development_dependency(%q<minitest>, ["~> 3.1"])
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
s.add_development_dependency(%q<nokogiri>, ["~> 1.5"])
s.add_development_dependency(%q<hoe-doofus>, ["~> 1.0"])
s.add_development_dependency(%q<hoe-gemspec>, ["~> 1.0"])
s.add_development_dependency(%q<hoe-git>, ["~> 1.0"])
s.add_development_dependency(%q<hoe-seattlerb>, ["~> 1.0"])
s.add_development_dependency(%q<hoe>, ["~> 3.0"])
else
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
s.add_dependency(%q<minitest>, ["~> 3.1"])
s.add_dependency(%q<rdoc>, ["~> 3.10"])
s.add_dependency(%q<nokogiri>, ["~> 1.5"])
s.add_dependency(%q<hoe-doofus>, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
s.add_dependency(%q<hoe-git>, ["~> 1.0"])
s.add_dependency(%q<hoe-seattlerb>, ["~> 1.0"])
s.add_dependency(%q<hoe>, ["~> 3.0"])
end
else
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
s.add_dependency(%q<minitest>, ["~> 3.1"])
s.add_dependency(%q<rdoc>, ["~> 3.10"])
s.add_dependency(%q<nokogiri>, ["~> 1.5"])
s.add_dependency(%q<hoe-doofus>, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
s.add_dependency(%q<hoe-git>, ["~> 1.0"])
s.add_dependency(%q<hoe-seattlerb>, ["~> 1.0"])
s.add_dependency(%q<hoe>, ["~> 3.0"])
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/ohai-6.18.0/lib/ohai/plugins/darwin/system_profiler.rb
|
#
# Author:: <NAME> (<<EMAIL>>)
# Copyright:: Copyright (c) 2009 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
provides "system_profile"
begin
require 'plist'
system_profile Array.new
items Array.new
detail_level = {
'mini' => [
"SPParallelATAData",
"SPAudioData",
"SPBluetoothData",
"SPCardReaderData",
"SPDiagnosticsData",
"SPDiscBurningData",
"SPEthernetData",
"SPFibreChannelData",
"SPFireWireData",
"SPDisplaysData",
"SPHardwareRAIDData",
"SPMemoryData",
"SPModemData",
"SPNetworkData",
"SPPCIData",
"SPParallelSCSIData",
"SPPrintersSoftwareData",
"SPPrintersData",
"SPSASData",
"SPSerialATAData",
"SPSoftwareData",
"SPThunderboltData",
"SPUSBData",
"SPWWANData",
"SPAirPortData"
],
'full' => [
"SPHardwareDataType"
]
}
detail_level.each do |level, data_types|
popen4("system_profiler -xml -detailLevel #{level} #{data_types.join(' ')}") do |pid, stdin, stdout, stderr|
stdin.close
Plist::parse_xml(stdout.read).each do |e|
items << e
end
end
end
system_profile items.sort_by { |h| h['_dataType'] }
rescue LoadError => e
Ohai::Log.debug("Can't load gem: #{e})")
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rdoc/ri/store.rb
|
# frozen_string_literal: false
module RDoc::RI
Store = RDoc::Store # :nodoc:
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/rdoc/test_rdoc_token_stream.rb
|
# frozen_string_literal: false
require 'rdoc/test_case'
class TestRDocTokenStream < RDoc::TestCase
def test_class_to_html
tokens = [
RDoc::RubyToken::TkCONSTANT. new(0, 0, 0, 'CONSTANT'),
RDoc::RubyToken::TkDEF. new(0, 0, 0, 'KW'),
RDoc::RubyToken::TkIVAR. new(0, 0, 0, 'IVAR'),
RDoc::RubyToken::TkOp. new(0, 0, 0, 'Op'),
RDoc::RubyToken::TkId. new(0, 0, 0, 'Id'),
RDoc::RubyToken::TkNode. new(0, 0, 0, 'Node'),
RDoc::RubyToken::TkCOMMENT. new(0, 0, 0, 'COMMENT'),
RDoc::RubyToken::TkREGEXP. new(0, 0, 0, 'REGEXP'),
RDoc::RubyToken::TkSTRING. new(0, 0, 0, 'STRING'),
RDoc::RubyToken::TkVal. new(0, 0, 0, 'Val'),
RDoc::RubyToken::TkBACKSLASH.new(0, 0, 0, '\\'),
]
expected = [
'<span class="ruby-constant">CONSTANT</span>',
'<span class="ruby-keyword">KW</span>',
'<span class="ruby-ivar">IVAR</span>',
'<span class="ruby-operator">Op</span>',
'<span class="ruby-identifier">Id</span>',
'<span class="ruby-node">Node</span>',
'<span class="ruby-comment">COMMENT</span>',
'<span class="ruby-regexp">REGEXP</span>',
'<span class="ruby-string">STRING</span>',
'<span class="ruby-value">Val</span>',
'\\'
].join
assert_equal expected, RDoc::TokenStream.to_html(tokens)
end
def test_class_to_html_empty
assert_equal '', RDoc::TokenStream.to_html([])
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/benchmark/bm_vm1_swap.rb
|
a = 1
b = 2
i=0
while i<30_000_000 # while loop 1
i+=1
a, b = b, a
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/winrm-1.8.1/spec/winrm_options_spec.rb
|
<reponame>arnab0073/idea<filename>.rvm/gems/ruby-2.3.0/gems/winrm-1.8.1/spec/winrm_options_spec.rb
# encoding: UTF-8
describe 'WinRM options', unit: true do
let(:subject) { WinRM::WinRMWebService.new('http://localhost:55985/wsman', :plaintext) }
context 'when operations timeout is set to 60' do
before(:each) { subject.set_timeout(60) }
describe '#receive_timeout' do
it 'is set to 70s' do
transportclass = subject.instance_variable_get(:@xfer)
expect(transportclass.receive_timeout).to eql(70)
end
end
describe '#op_timeout' do
it 'is set to 60s' do
expect(subject.timeout).to eql('PT60S')
end
end
end
context 'when operations timeout is set to 30 and receive timeout is set to 120' do
before(:each) { subject.set_timeout(30, 120) }
describe '#receive_timeout' do
it 'is set to 120s' do
transportclass = subject.instance_variable_get(:@xfer)
expect(transportclass.receive_timeout).to eql(120)
end
end
describe '#op_timeout' do
it 'is set to 30s' do
expect(subject.timeout).to eql('PT30S')
end
end
end
context 'when max_env_size is set to 614400' do
before(:each) { subject.max_env_size(614_400) }
describe '@max_env_sz' do
it 'is set to 614400' do
expect(subject.instance_variable_get('@max_env_sz')).to eq(614_400)
end
end
end
context 'when locale is set to en-CA' do
before(:each) { subject.locale('en-CA') }
describe '@locale' do
it 'is set to en-CA' do
expect(subject.instance_variable_get('@locale')).to eq('en-CA')
end
end
end
context 'default' do
describe '#receive_timeout' do
it 'should be 70s' do
transportclass = subject.instance_variable_get(:@xfer)
expect(transportclass.receive_timeout).to eql(70)
end
end
describe '#timeout' do
it 'should be 60s' do
expect(subject.timeout).to eql('PT60S')
end
end
describe '@locale' do
it 'should be en-US' do
expect(subject.instance_variable_get('@locale')).to eq('en-US')
end
end
describe '@max_env_sz' do
it 'should be 153600' do
expect(subject.instance_variable_get('@max_env_sz')).to eq(153_600)
end
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb
|
#
# tkextlib/bwidget/pagesmanager.rb
# by <NAME> (<EMAIL>)
#
require 'tk'
require 'tk/frame'
require 'tkextlib/bwidget.rb'
module Tk
module BWidget
class PagesManager < TkWindow
end
end
end
class Tk::BWidget::PagesManager
TkCommandNames = ['PagesManager'.freeze].freeze
WidgetClassName = 'PagesManager'.freeze
WidgetClassNames[WidgetClassName] ||= self
def tagid(id)
# id.to_s
_get_eval_string(id)
end
def add(page, &b)
win = window(tk_send('add', tagid(page)))
if b
if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
win.instance_exec(self, &b)
else
win.instance_eval(&b)
end
end
win
end
def compute_size
tk_send('compute_size')
self
end
def delete(page)
tk_send('delete', tagid(page))
self
end
def get_frame(page, &b)
win = window(tk_send('getframe', tagid(page)))
if b
if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
win.instance_exec(self, &b)
else
win.instance_eval(&b)
end
end
win
end
def get_page(page)
tk_send('pages', page)
end
def pages(first=None, last=None)
list(tk_send('pages', first, last))
end
def raise(page=None)
tk_send('raise', page)
self
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/ohai-6.18.0/spec/unit/plugins/linux/lsb_spec.rb
|
<gh_stars>1-10
#
# Author:: <NAME> (<<EMAIL>>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
# We do not alter case for lsb attributes and consume them as provided
describe Ohai::System, "Linux lsb plugin" do
before(:each) do
@ohai = Ohai::System.new
@ohai[:os] = "linux"
@ohai.stub!(:require_plugin).and_return(true)
@ohai.extend(SimpleFromFile)
end
describe "on systems with /etc/lsb-release" do
before(:each) do
@mock_file = mock("/etc/lsb-release")
@mock_file.stub!(:each).
and_yield("DISTRIB_ID=Ubuntu").
and_yield("DISTRIB_RELEASE=8.04").
and_yield("DISTRIB_CODENAME=hardy").
and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
File.stub!(:open).with("/etc/lsb-release").and_return(@mock_file)
File.stub!(:exists?).with("/etc/lsb-release").and_return(true)
end
it "should set lsb[:id]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:id].should == "Ubuntu"
end
it "should set lsb[:release]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:release].should == "8.04"
end
it "should set lsb[:codename]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:codename].should == "hardy"
end
it "should set lsb[:description]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:description].should == "Ubuntu 8.04"
end
end
describe "on systems with /usr/bin/lsb_release" do
before(:each) do
File.stub!(:exists?).with("/etc/lsb-release").and_return(false)
File.stub!(:exists?).with("/usr/bin/lsb_release").and_return(true)
@stdin = mock("STDIN", { :close => true })
@pid = 10
@stderr = mock("STDERR")
@stdout = mock("STDOUT")
@status = 0
end
describe "on Centos 5.4 correctly" do
before(:each) do
@stdout.stub!(:each).
and_yield("LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch").
and_yield("Distributor ID: CentOS").
and_yield("Description: CentOS release 5.4 (Final)").
and_yield("Release: 5.4").
and_yield("Codename: Final")
@ohai.stub!(:popen4).with("lsb_release -a").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
end
it "should set lsb[:id]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:id].should == "CentOS"
end
it "should set lsb[:release]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:release].should == "5.4"
end
it "should set lsb[:codename]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:codename].should == "Final"
end
it "should set lsb[:description]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:description].should == "CentOS release 5.4 (Final)"
end
end
describe "on Fedora 14 correctly" do
before(:each) do
@stdout.stub!(:each).
and_yield("LSB Version: :core-4.0-ia32:core-4.0-noarch").
and_yield("Distributor ID: Fedora").
and_yield("Description: Fedora release 14 (Laughlin)").
and_yield("Release: 14").
and_yield("Codename: Laughlin")
@ohai.stub!(:popen4).with("lsb_release -a").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
end
it "should set lsb[:id]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:id].should == "Fedora"
end
it "should set lsb[:release]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:release].should == "14"
end
it "should set lsb[:codename]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:codename].should == "Laughlin"
end
it "should set lsb[:description]" do
@ohai._require_plugin("linux::lsb")
@ohai[:lsb][:description].should == "Fedora release 14 (Laughlin)"
end
end
end
it "should not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
File.stub!(:exists?).with("/etc/lsb-release").and_return(false)
File.stub!(:exists?).with("/usr/bin/lsb_release").and_return(false)
@ohai.attribute?(:lsb).should be(false)
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/ripper/tools/strip.rb
|
<filename>.rvm/src/ruby-1.9.3-p551/ext/ripper/tools/strip.rb
last_is_void = false
ARGF.each do |line|
if line.strip.empty?
#puts() unless last_is_void
last_is_void = true
elsif /\A\#/ === line
;
else
print line
last_is_void = false
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/rubyntlm-0.6.0/spec/lib/net/ntlm/int16_le_spec.rb
|
require 'spec_helper'
describe Net::NTLM::Int16LE do
int_values = {
:default => 15,
:default_hex => "\x0F\x00",
:alt => 14,
:alt_hex => "\x0E\x00",
:small => "\x0F",
:size => 2,
:bits => 16
}
it_behaves_like 'a field', 15, false
it_behaves_like 'an integer field', int_values
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/rubygems/test_gem_source_fetch_problem.rb
|
<reponame>arnab0073/idea<gh_stars>1-10
# frozen_string_literal: false
require 'rubygems/test_case'
class TestGemSourceFetchProblem < Gem::TestCase
def test_exception
source = Gem::Source.new @gem_repo
error = RuntimeError.new 'test'
sf = Gem::SourceFetchProblem.new source, error
e = assert_raises RuntimeError do
raise sf
end
assert_equal 'test', e.message
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/blt/graph.rb
|
<gh_stars>1-10
#
# tkextlib/blt/graph.rb
# by <NAME> (<EMAIL>)
#
require 'tk'
require 'tkextlib/blt.rb'
require 'tkextlib/blt/component.rb'
module Tk::BLT
class Graph < TkWindow
TkCommandNames = ['::blt::graph'.freeze].freeze
WidgetClassName = 'Graph'.freeze
WidgetClassNames[WidgetClassName] ||= self
include PlotComponent
include GraphCommand
def __boolval_optkeys
['bufferelements', 'invertxy']
end
private :__boolval_optkeys
def __strval_optkeys
['text', 'label', 'title', 'file', 'plotbackground']
end
private :__strval_optkeys
=begin
BarElement_ID = ['blt_graph_bar'.freeze, TkUtil.untrust('00000')].freeze
def bar(elem=nil, keys={})
if elem.kind_of?(Hash)
keys = elem
elem = nil
end
unless elem
elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
BarElement_ID[1].succ!
end
tk_send('bar', elem, keys)
Element.new(self, elem, :without_creating=>true)
end
=end
def extents(item)
num_or_str(tk_send_without_enc('extents', item))
end
def invtransform(x, y)
list(tk_send_without_enc('invtransform', x, y))
end
def inside(x, y)
bool(tk_send_without_enc('inside', x, y))
end
def snap(output, keys={})
tk_send_without_enc('snap', *(hash_kv(keys, false) + output))
self
end
def transform(x, y)
list(tk_send_without_enc('transform', x, y))
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/tktable/command.rb
|
#!/usr/bin/env ruby
##
## command.rb
##
## This demo shows the use of the table widget's -command options
##
## ( based on 'command.tcl' included source archive of tktable extension )
##
require 'tk'
require 'tkextlib/tktable'
# create the table
data = TkVariable.new_hash
rows = 10
cols = 10
# fill table variable
((-(rows))..rows).each{|x|
((-(cols))..cols).each{|y|
data[x,y] = "#{x} x #{y}"
}
}
lbl = TkLabel.new(:text=>"TkTable :command Example")
cur_var = TkVariable.new
current = TkLabel.new(:textvariable=>cur_var, :width=>5)
ent_var = TkVariable.new
entry = TkEntry.new(:textvariable=>ent_var)
table = Tk::TkTable.new(:rows=>rows, :cols=>cols,
:command=>[proc{|mode, cell, val|
if (mode == :w)
data[cell] = val
else
begin
data[cell] # exist
rescue
'' # not exist
end
end
}, '%i %C %s'],
:width=>6, :height=>6,
:titlerows=>1, :titlecols=>1,
:roworigin=>-1, :colorigin=>-1,
:rowstretchmode=>:last, :colstretchmode=>:last,
:rowtagcommand=>proc{|row|
row = Integer(row)
(row>0 && row%2 == 1)? 'OddRow': ''
},
:coltagcommand=>proc{|col|
col = Integer(col)
(col>0 && col%2 == 1)? 'OddCol': ''
},
:selectmode=>:extended, :flashmode=>true,
:rowstretch=>:unset, :colstretch=>:unset,
:browsecommand=>[proc{|w, s|
cur_var.value = s
ent_var.value = w.get(s)
}, '%W %S'],
:validate=>true,
:validatecommand=>proc{|e|
ent_var.value = e.new_value; true
})
=begin
:validatecommand=>[
proc{|s|
ent_var.value = s; true
}, '%S'])
=end
sx = table.xscrollbar(TkScrollbar.new)
sy = table.yscrollbar(TkScrollbar.new)
entry.bind('Return', proc{|w| table.curvalue = w.value}, '%W')
Tk.grid(lbl, '-', '-', :sticky=>:ew)
Tk.grid(current, entry, '-', :sticky=>:ew)
Tk.grid(table, '-', sy, :sticky=>:news)
Tk.grid(sx, '-', :sticky=>:ew)
Tk.root.grid_columnconfig(1, :weight=>1)
Tk.root.grid_rowconfig(2, :weight=>1)
table.tag_configure('OddRow', :bg=>'orange', :fg=>'purple')
table.tag_configure('OddCol', :bg=>'brown', :fg=>'pink')
puts "Table is #{table.path}"
Tk.mainloop
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkvirtevent.rb
|
<reponame>arnab0073/idea<gh_stars>10-100
#
# tkvirtevent.rb - load tk/virtevent.rb
#
require 'tk/virtevent'
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/logging-2.1.0/examples/formatting.rb
|
<reponame>arnab0073/idea
# :stopdoc:
#
# Any Ruby object can be passed to the log methods of a logger. How these
# objects are formatted by the Logging framework is controlled by a global
# "format_as" option and a global "backtrace" option.
#
# The format_as option allows objects to be converted to a string using the
# standard "to_s" method, the "inspect" method, the "to_json" method, or the
# "to_yaml" method (this is independent of the YAML layout). The format_as
# option can be overridden by each layout as desired.
#
# Logging.format_as :string # or :inspect or :json or :yaml
#
# Exceptions are treated differently by the logging framework. The Exception
# class is printed along with the message. Optionally, the exception backtrace
# can be included in the logging output; this option is enabled by default.
#
# Logging.backtrace false
#
# The backtrace can be enabled or disabled for each layout as needed.
#
require 'logging'
Logging.format_as :inspect
Logging.backtrace false
Logging.appenders.stdout(
:layout => Logging.layouts.basic(:format_as => :yaml)
)
Logging.appenders.stderr(
:layout => Logging.layouts.basic(:backtrace => true)
)
log = Logging.logger['foo']
log.appenders = %w[stdout stderr]
# these log messages will all appear twice because of the two appenders -
# STDOUT and STDERR - but the interesting thing is the difference in the
# output
log.info %w[An Array Of Strings]
log.info({"one"=>1, "two"=>2})
begin
1 / 0
rescue => err
log.error err
end
# :startdoc:
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/puma-1.6.3/lib/puma/control_cli.rb
|
require 'optparse'
require 'puma/const'
require 'puma/configuration'
require 'yaml'
require 'uri'
require 'socket'
module Puma
class ControlCLI
def initialize(argv, stdout=STDOUT)
@argv = argv
@stdout = stdout
end
def setup_options
@parser = OptionParser.new do |o|
o.on "-S", "--state PATH", "Where the state file to use is" do |arg|
@path = arg
end
end
end
def connect
if str = @config.options[:control_url]
uri = URI.parse str
case uri.scheme
when "tcp"
return TCPSocket.new uri.host, uri.port
when "unix"
path = "#{uri.host}#{uri.path}"
return UNIXSocket.new path
else
raise "Invalid URI: #{str}"
end
end
raise "No status address configured"
end
def run
setup_options
@parser.parse! @argv
@state = YAML.load File.read(@path)
@config = @state['config']
cmd = @argv.shift
meth = "command_#{cmd}"
if respond_to?(meth)
__send__(meth)
else
raise "Unknown command: #{cmd}"
end
end
def request(sock, url)
token = @config.options[:control_auth_token]
if token
url = "#{url}?token=#{token}"
end
sock << "GET #{url} HTTP/1.0\r\n\r\n"
rep = sock.read.split("\r\n")
m = %r!HTTP/1.\d (\d+)!.match(rep.first)
if m[1] == "403"
raise "Unauthorized access to server (wrong auth token)"
elsif m[1] != "200"
raise "Bad response code from server: #{m[1]}"
end
return rep.last
end
def command_pid
@stdout.puts "#{@state['pid']}"
end
def command_stop
sock = connect
body = request sock, "/stop"
if body != '{ "status": "ok" }'
raise "Invalid response: '#{body}'"
else
@stdout.puts "Requested stop from server"
end
end
def command_halt
sock = connect
body = request sock, "/halt"
if body != '{ "status": "ok" }'
raise "Invalid response: '#{body}'"
else
@stdout.puts "Requested halt from server"
end
end
def command_restart
sock = connect
body = request sock, "/restart"
if body != '{ "status": "ok" }'
raise "Invalid response: '#{body}'"
else
@stdout.puts "Requested restart from server"
end
end
def command_stats
sock = connect
body = request sock, "/stats"
@stdout.puts body
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/gssapi-1.2.0/lib/gssapi/extensions.rb
|
=begin
Copyright © 2014 <NAME> <<EMAIL>>
Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
=end
module GSSAPI
module LibGSSAPI
# Some versions of GSSAPI might not have support for IOV yet.
begin
# OM_uint32 GSSAPI_LIB_FUNCTION gss_wrap_iov( OM_uint32 * minor_status, gss_ctx_id_t context_handle,
# int conf_req_flag, gss_qop_t qop_req, int * conf_state, gss_iov_buffer_desc * iov, int iov_count );
attach_function :gss_wrap_iov, [:pointer, :pointer, :int, :OM_uint32, :pointer, :pointer, :int], :OM_uint32
# OM_uint32 GSSAPI_LIB_FUNCTION gss_unwrap_iov ( OM_uint32 * minor_status, gss_ctx_id_t context_handle,
# int * conf_state, gss_qop_t * qop_state, gss_iov_buffer_desc * iov, int iov_count )
attach_function :gss_unwrap_iov, [:pointer, :pointer, :pointer, :pointer, :pointer, :int], :OM_uint32
# OM_uint32 GSSAPI_LIB_CALL gss_wrap_iov_length ( OM_uint32 * minor_status, gss_ctx_id_t context_handle,
# int conf_req_flag, gss_qop_t qop_req, int * conf_state, gss_iov_buffer_desc * iov, int iov_count)
attach_function :gss_wrap_iov_length, [:pointer, :pointer, :int, :OM_uint32, :pointer, :pointer, :int], :OM_uint32
rescue FFI::NotFoundError => ex
warn "WARNING: Could not load IOV methods. Check your GSSAPI C library for an update"
end
begin
# OM_uint32 gss_wrap_aead(OM_uint32 * minor_status, gss_ctx_id_t context_handle, int conf_req_flag,
# gss_qop_t qop_req, gss_buffer_t input_assoc_buffer,
# gss_buffer_t input_payload_buffer, int * conf_state, gss_buffer_t output_message_buffer);
attach_function :gss_wrap_aead, [:pointer, :pointer, :int, :OM_uint32, :pointer, :pointer, :pointer, :pointer], :OM_uint32
# OM_uint32 gss_unwrap_aead(OM_uint32 * minor_status, gss_ctx_id_t context_handle, gss_buffer_t input_message_buffer,
# gss_buffer_t input_assoc_buffer, gss_buffer_t output_payload_buffer, int * conf_state, gss_qop_t * qop_state);
attach_function :gss_unwrap_aead, [:pointer,:pointer,:pointer,:pointer,:pointer,:pointer,:pointer], :OM_uint32
rescue FFI::NotFoundError => ex
warn "WARNING: Could not load AEAD methods. Check your GSSAPI C library for an update"
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb
|
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
rb = Tk::Iwidgets::Radiobox.new(:labeltext=>'Fonts')
rb.add('times', :text=>'Times')
rb.add('helvetica', :text=>'Helvetica')
rb.add('courier', :text=>'Courier')
rb.add('symbol', :text=>'Symbol')
rb.select('courier')
rb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
Tk.mainloop
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/mixlib-shellout-2.2.6/lib/mixlib/shellout/version.rb
|
<reponame>arnab0073/idea<filename>.rvm/gems/ruby-2.3.0/gems/mixlib-shellout-2.2.6/lib/mixlib/shellout/version.rb
module Mixlib
class ShellOut
VERSION = "2.2.6"
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/yajl-ruby-1.2.1/lib/yajl/json_gem/encoding.rb
|
require 'yajl' unless defined?(Yajl::Parser)
# NOTE: this is probably temporary until I can split out the JSON compat C code into it's own
# extension that can be included when this file is.
Yajl::Encoder.enable_json_gem_compatability
# Our fallback to_json definition
unless defined?(ActiveSupport)
class Object
def to_json(*args, &block)
"\"#{to_s}\""
end
end
end
module JSON
class JSONError < StandardError; end unless defined?(JSON::JSONError)
class GeneratorError < JSONError; end unless defined?(JSON::GeneratorError)
def self.generate(obj, opts=nil)
opts ||= {}
options_map = {}
if opts.has_key?(:indent)
options_map[:pretty] = true
options_map[:indent] = opts[:indent]
end
Yajl::Encoder.encode(obj, options_map)
rescue Yajl::EncodeError => e
raise JSON::GeneratorError, e.message
end
def self.pretty_generate(obj, opts={})
begin
options_map = {}
options_map[:pretty] = true
options_map[:indent] = opts[:indent] if opts.has_key?(:indent)
Yajl::Encoder.encode(obj, options_map)
rescue Yajl::EncodeError => e
raise JSON::GeneratorError, e.message
end
end
def self.dump(obj, io=nil, *args)
begin
Yajl::Encoder.encode(obj, io)
rescue Yajl::EncodeError => e
raise JSON::GeneratorError, e.message
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/bwidget/spinbox.rb
|
#
# tkextlib/bwidget/entry.rb
# by <NAME> (<EMAIL>)
#
require 'tk'
require 'tkextlib/bwidget.rb'
require 'tkextlib/bwidget/arrowbutton'
require 'tkextlib/bwidget/entry'
module Tk
module BWidget
class SpinBox < Tk::Entry
end
end
end
class Tk::BWidget::SpinBox
include Scrollable
TkCommandNames = ['SpinBox'.freeze].freeze
WidgetClassName = 'SpinBox'.freeze
WidgetClassNames[WidgetClassName] ||= self
def __strval_optkeys
super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
end
private :__strval_optkeys
def __boolval_optkeys
super() << 'dragenabled' << 'dropenabled' << 'editable'
end
private :__boolval_optkeys
def __listval_optkeys
super() << 'values'
end
private :__listval_optkeys
def __tkvariable_optkeys
super() << 'helpvar'
end
private :__tkvariable_optkeys
#def entrybind(*args)
# _bind([path, 'bind'], *args)
# self
#end
def entrybind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
end
_bind([path, 'bind'], context, cmd, *args)
self
end
#def entrybind_append(*args)
# _bind_append([path, 'bind'], *args)
# self
#end
def entrybind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
end
_bind_append([path, 'bind'], context, cmd, *args)
self
end
def entrybind_remove(*args)
_bind_remove([path, 'bind'], *args)
self
end
def entrybindinfo(*args)
_bindinfo([path, 'bind'], *args)
self
end
def get_index_of_value
number(tk_send_without_enc('getvalue'))
end
alias get_value get_index_of_value
alias get_value_index get_index_of_value
def set_value_by_index(idx)
idx = "@#{idx}" if idx.kind_of?(Integer)
tk_send_without_enc('setvalue', idx)
self
end
alias set_value set_value_by_index
alias set_index_value set_value_by_index
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/win32ole/test_win32ole.rb
|
<reponame>arnab0073/idea
# coding: us-ascii
# frozen_string_literal: false
begin
require 'win32ole'
rescue LoadError
end
require 'test/unit'
if defined?(WIN32OLE)
module CONST1
end
module CONST2
end
module TestCaseForDict
def test_convert_bignum
@dict1.add("a", 9999999999)
@dict1.add("b", 999999999)
@dict1.add("c", @dict1.item("b") * 10 + 9)
assert_equal(9999999999, @dict1.item("a"))
assert_equal(9999999999, @dict1.item("c"))
end
def test_add
@dict1.add("a", 1000)
assert_equal(1000, @dict1.item("a"))
end
def test_setproperty_equal_ended
@dict1.compareMode = 1
@dict1.add("one", 1)
assert_equal(1, @dict1.item("ONE"))
@dict2.add("one", 1)
assert_nil(@dict2.item("ONE"))
assert_equal(1, @dict2.item("one"))
end
def test_non_exist_property
assert_raise(WIN32OLERuntimeError) {
@dict1.unknown_property = 1
}
end
def test_raise_message
exc = assert_raise(WIN32OLERuntimeError) {
@dict1.add
}
assert_match(/^\(in OLE method `add': \)/, exc.message) #`
exc = assert_raise(WIN32OLERuntimeError) {
@dict1._invoke(1, [], [])
}
assert_match(/^\(in OLE method `<dispatch id:1>': \)/, exc.message) #`
exc = assert_raise(WIN32OLERuntimeError) {
@dict1.compareMode = -1
}
assert_match(/^\(in setting property `compareMode': \)/, exc.message) #`
end
def test_no_method_error
exc = assert_raise(NoMethodError) {
@dict1.non_exist_method
}
assert_match(/non_exist_method/, exc.message)
end
def test_ole_methods
methods = @dict1.ole_methods
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("Add"))
end
def test_ole_func_methods
methods = @dict1.ole_func_methods
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("Add"))
end
def test_ole_put_methods
methods = @dict1.ole_put_methods
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("CompareMode"))
end
def test_ole_get_methods
methods = @dict1.ole_get_methods
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("Count"))
end
def test_ole_mehtod_help
minfo = @dict1.ole_method_help("Add")
assert_equal(2, minfo.size_params)
end
def test_ole_typelib
tlib = @dict1.ole_typelib
assert_equal("Microsoft Scripting Runtime", tlib.name);
end
def test_each
@dict1.add("one", 1)
@dict1.add("two", 2)
i = 0
@dict1.keys.each do |item|
i += 1
end
assert_equal(2, i)
end
def test_bracket
@dict1.add("foo", "FOO")
assert_equal("FOO", @dict1.item("foo"))
assert_equal("FOO", @dict1["foo"])
end
def test_bracket_equal
@dict1.add("foo", "FOO")
@dict1["foo"] = "BAR"
assert_equal("BAR", @dict1["foo"])
end
def test_bracket_with_numkey
@dict1.add(1, "ONE")
@dict1.add(2, "two")
assert_equal("ONE", @dict1[1])
@dict1[2] = "TWO"
assert_equal("TWO", @dict1[2])
end
def test_invoke_with_array
@dict1.add("ary1", [1,2,3])
assert_equal([1,2,3], @dict1["ary1"])
@dict1.add("ary2", [[1,2,"a"], [3,4,"b"]])
assert_equal([[1,2,"a"], [3,4,"b"]], @dict1["ary2"])
@dict1.add("ary3", [[[1]]])
assert_equal([[[1]]], @dict1["ary3"])
@dict1.add("ary4", [[[1], [2], [3]], [[4], [5], [6]]])
assert_equal([[[1],[2], [3]], [[4], [5], [6]]], @dict1["ary4"])
end
end
class TestWin32OLE < Test::Unit::TestCase
include TestCaseForDict
def setup
@dict1 = WIN32OLE.new('Scripting.Dictionary')
@dict2 = WIN32OLE.new('Scripting.Dictionary')
end
def test_s_new
assert_instance_of(WIN32OLE, @dict1)
assert_instance_of(WIN32OLE, @dict2)
end
def test_s_new_exc
assert_raise(TypeError) {
WIN32OLE.new(1)
}
assert_raise(TypeError) {
WIN32OLE.new("Scripting.Dictionary", 1)
}
end
def test_s_new_exc_svr_tainted
th = Thread.start {
$SAFE = 1
svr = "Scripting.Dictionary"
svr.taint
WIN32OLE.new(svr)
}
exc = assert_raise(SecurityError) {
th.join
}
assert_match(/insecure object creation - `Scripting.Dictionary'/, exc.message)
end
def test_s_new_exc_host_tainted
th = Thread.start {
$SAFE = 1
svr = "Scripting.Dictionary"
host = "localhost"
host.taint
WIN32OLE.new(svr, host)
}
exc = assert_raise(SecurityError) {
th.join
}
assert_match(/insecure object creation - `localhost'/, exc.message)
end
def test_s_new_DCOM
rshell = WIN32OLE.new("Shell.Application")
assert_instance_of(WIN32OLE, rshell)
end
def test_s_new_from_clsid
shell = WIN32OLE.new("{13709620-C279-11CE-A49E-444553540000}")
assert_instance_of(WIN32OLE, shell)
exc = assert_raise(WIN32OLERuntimeError) {
WIN32OLE.new("{000}")
}
assert_match(/unknown OLE server: `\{000\}'/, exc.message) #`
end
def test_s_connect
obj = WIN32OLE.connect("winmgmts:")
assert_instance_of(WIN32OLE, obj)
end
def test_s_connect_exc
assert_raise(TypeError) {
WIN32OLE.connect(1)
}
end
def test_s_coonect_exc_tainted
th = Thread.start {
$SAFE = 1
svr = "winmgmts:"
svr.taint
WIN32OLE.connect(svr)
}
exc = assert_raise(SecurityError) {
th.join
}
assert_match(/insecure connection - `winmgmts:'/, exc.message)
end
def test_invoke_accept_symbol_hash_key
fso = WIN32OLE.new('Scripting.FileSystemObject')
afolder = fso.getFolder(".")
bfolder = fso.getFolder({"FolderPath" => "."})
cfolder = fso.getFolder({:FolderPath => "."})
assert_equal(afolder.path, bfolder.path)
assert_equal(afolder.path, cfolder.path)
fso = nil
end
def test_setproperty
installer = WIN32OLE.new("WindowsInstaller.Installer")
record = installer.CreateRecord(2)
# this is the way to set property with argument in Win32OLE.
record.setproperty( "StringData", 1, 'dddd')
assert_equal('dddd', record.StringData(1))
end
def test_ole_type
fso = WIN32OLE.new('Scripting.FileSystemObject')
tobj = fso.ole_type
assert_match(/^IFileSystem/, tobj.name)
end
def test_ole_obj_help
fso = WIN32OLE.new('Scripting.FileSystemObject')
tobj = fso.ole_obj_help
assert_match(/^IFileSystem/, tobj.name)
end
def test_invoke_hash_key_non_str_sym
fso = WIN32OLE.new('Scripting.FileSystemObject')
begin
fso.getFolder({1 => "."})
assert(false)
rescue TypeError
assert(true)
end
fso = nil
end
def test_get_win32ole_object
shell = WIN32OLE.new('Shell.Application')
folder = shell.nameSpace(0)
assert_instance_of(WIN32OLE, folder)
end
def test_invoke_accept_multi_hash_key
shell = WIN32OLE.new('Shell.Application')
folder = shell.nameSpace(0)
item = folder.items.item(0)
name = folder.getDetailsOf(item, 0)
assert_equal(item.name, name)
name = folder.getDetailsOf({:vItem => item, :iColumn => 0})
assert_equal(item.name, name)
name = folder.getDetailsOf({"vItem" => item, :iColumn => 0})
assert_equal(item.name, name)
end
def test_ole_invoke_with_named_arg_last
shell = WIN32OLE.new('Shell.Application')
folder = shell.nameSpace(0)
item = folder.items.item(0)
name = folder.getDetailsOf(item, {:iColumn => 0})
assert_equal(item.name, name)
end
def test__invoke
shell=WIN32OLE.new('Shell.Application')
assert_equal(shell.NameSpace(0).title, shell._invoke(0x60020002, [0], [WIN32OLE::VARIANT::VT_VARIANT]).title)
end
def test_ole_query_interface
shell=WIN32OLE.new('Shell.Application')
assert_raise(ArgumentError) {
shell.ole_query_interface
}
assert_raise(TypeError) {
shell.ole_query_interface(0x11223344)
}
shell2 = shell.ole_query_interface('{A4C6892C-3BA9-11D2-9DEA-00C04FB16162}')
assert_instance_of(WIN32OLE, shell2)
end
def test_ole_respond_to
fso = WIN32OLE.new('Scripting.FileSystemObject')
assert(fso.ole_respond_to?('getFolder'))
assert(fso.ole_respond_to?('GETFOLDER'))
assert(fso.ole_respond_to?(:getFolder))
assert(!fso.ole_respond_to?('XXXXX'))
assert_raise(TypeError) {
assert_raise(fso.ole_respond_to?(1))
}
end
def test_invoke
fso = WIN32OLE.new('Scripting.FileSystemObject')
assert(fso.invoke(:getFolder, "."))
assert(fso.invoke('getFolder', "."))
end
def test_s_const_load
assert(!defined?(CONST1::SsfWINDOWS))
shell=WIN32OLE.new('Shell.Application')
WIN32OLE.const_load(shell, CONST1)
assert_equal(36, CONST1::SsfWINDOWS)
assert(!defined?(CONST2::SsfWINDOWS))
WIN32OLE.const_load("Microsoft Shell Controls And Automation", CONST2)
assert_equal(36, CONST2::SsfWINDOWS)
end
def test_s_create_guid
guid = WIN32OLE.create_guid
assert_match(/^\{[A-Z0-9]{8}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{12}/,
guid)
end
#
# WIN32OLE.codepage is initialized according to Encoding.default_external.
#
# def test_s_codepage
# assert_equal(WIN32OLE::CP_ACP, WIN32OLE.codepage)
# end
def test_s_codepage_set
cp = WIN32OLE.codepage
WIN32OLE.codepage = WIN32OLE::CP_UTF8
assert_equal(WIN32OLE::CP_UTF8, WIN32OLE.codepage)
WIN32OLE.codepage = cp
end
def test_s_codepage_changed
cp = WIN32OLE.codepage
fso = WIN32OLE.new("Scripting.FileSystemObject")
fname = fso.getTempName
begin
obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8"))
WIN32OLE.codepage = WIN32OLE::CP_UTF8
assert_equal("\xE3\x81\x82".force_encoding("CP65001"), obj.value)
begin
WIN32OLE.codepage = 932 # Windows-31J
rescue WIN32OLERuntimeError
end
if (WIN32OLE.codepage == 932)
assert_equal("\x82\xA0".force_encoding("CP932"), obj.value)
end
begin
WIN32OLE.codepage = 20932 # MS EUC-JP
rescue WIN32OLERuntimeError
end
if (WIN32OLE.codepage == 20932)
assert_equal("\xA4\xA2".force_encoding("CP20932"), obj.value)
end
WIN32OLE.codepage = cp
file = fso.opentextfile(fname, 2, true)
test_str = [0x3042].pack("U*").encode("UTF-16LE")
begin
file.write test_str.force_encoding("UTF-16")
ensure
file.close
end
str = ""
open(fname, "r:ascii-8bit") {|ifs|
str = ifs.read
}
assert_equal(test_str.force_encoding("ascii-8bit"), str)
# This test fail if codepage 20932 (euc) is not installed.
begin
WIN32OLE.codepage = 20932
rescue WIN32OLERuntimeError
end
if (WIN32OLE.codepage == 20932)
WIN32OLE.codepage = cp
file = fso.opentextfile(fname, 2, true)
begin
file.write [164, 162].pack("c*").force_encoding("UTF-16")
ensure
file.close
end
open(fname, "r:ascii-8bit") {|ifs|
str = ifs.read
}
assert_equal("\244\242", str)
end
ensure
WIN32OLE.codepage = cp
if (File.exist?(fname))
File.unlink(fname)
end
end
end
def test_cp51932
cp = WIN32OLE.codepage
begin
obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8"))
begin
WIN32OLE.codepage = 51932
rescue
end
if WIN32OLE.codepage == 51932
assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value)
end
ensure
WIN32OLE.codepage = cp
end
end
def test_s_locale
assert_equal(WIN32OLE::LOCALE_SYSTEM_DEFAULT, WIN32OLE.locale)
end
def test_s_locale_set
begin
begin
WIN32OLE.locale = 1041
rescue WIN32OLERuntimeError
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_set is skipped(Japanese locale is not installed)")
return
end
assert_equal(1041, WIN32OLE.locale)
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
assert_raise(WIN32OLERuntimeError) {
WIN32OLE.locale = 111
}
assert_equal(WIN32OLE::LOCALE_SYSTEM_DEFAULT, WIN32OLE.locale)
ensure
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
end
end
def test_s_locale_change
begin
begin
WIN32OLE.locale = 0x0411
rescue WIN32OLERuntimeError
end
if WIN32OLE.locale == 0x0411
obj = WIN32OLE_VARIANT.new("\\100,000", WIN32OLE::VARIANT::VT_CY)
assert_equal("100000", obj.value)
assert_raise(WIN32OLERuntimeError) {
obj = WIN32OLE_VARIANT.new("$100.000", WIN32OLE::VARIANT::VT_CY)
}
else
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_change is skipped(Japanese locale is not installed)")
end
begin
WIN32OLE.locale = 1033
rescue WIN32OLERuntimeError
end
if WIN32OLE.locale == 1033
obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY)
assert_equal("100000", obj.value)
else
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_change is skipped(US English locale is not installed)")
end
ensure
WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT
end
end
def test_const_CP_ACP
assert_equal(0, WIN32OLE::CP_ACP)
end
def test_const_CP_OEMCP
assert_equal(1, WIN32OLE::CP_OEMCP)
end
def test_const_CP_MACCP
assert_equal(2, WIN32OLE::CP_MACCP)
end
def test_const_CP_THREAD_ACP
assert_equal(3, WIN32OLE::CP_THREAD_ACP)
end
def test_const_CP_SYMBOL
assert_equal(42, WIN32OLE::CP_SYMBOL)
end
def test_const_CP_UTF7
assert_equal(65000, WIN32OLE::CP_UTF7)
end
def test_const_CP_UTF8
assert_equal(65001, WIN32OLE::CP_UTF8)
end
def test_const_LOCALE_SYSTEM_DEFAULT
assert_equal(0x0800, WIN32OLE::LOCALE_SYSTEM_DEFAULT);
end
def test_const_LOCALE_USER_DEFAULT
assert_equal(0x0400, WIN32OLE::LOCALE_USER_DEFAULT);
end
def test_method_missing
assert_raise(ArgumentError) {@dict1.method_missing}
assert_raise(TypeError) {@dict1.method_missing(1)}
assert_raise(ArgumentError) {@dict1.method_missing("foo=")}
assert_raise(ArgumentError) {@dict1.method_missing("foo=", 1, 2)}
end
end
# test of subclass of WIN32OLE
class MyDict < WIN32OLE
def MyDict.new
super('Scripting.Dictionary')
end
end
class TestMyDict < Test::Unit::TestCase
include TestCaseForDict
def setup
@dict1 = MyDict.new
@dict2 = MyDict.new
end
def test_s_new
assert_instance_of(MyDict, @dict1)
assert_instance_of(MyDict, @dict2)
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/ext/json/lib/json/add/regexp.rb
|
# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
# Regexp serialization/deserialization
class Regexp
# Deserializes JSON string by constructing new Regexp object with source
# <tt>s</tt> (Regexp or String) and options <tt>o</tt> serialized by
# <tt>to_json</tt>
def self.json_create(object)
new(object['s'], object['o'])
end
# Returns a hash, that will be turned into a JSON object and represent this
# object.
def as_json(*)
{
JSON.create_id => self.class.name,
'o' => options,
's' => source,
}
end
# Stores class name (Regexp) with options <tt>o</tt> and source <tt>s</tt>
# (Regexp or String) as JSON string
def to_json(*)
as_json.to_json
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/ext/-test-/typeddata/extconf.rb
|
<filename>.rvm/src/ruby-2.3.0/ext/-test-/typeddata/extconf.rb
# frozen_string_literal: false
create_makefile("-test-/typeddata/typeddata")
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rubygems/source/lock.rb
|
<gh_stars>0
# frozen_string_literal: false
##
# A Lock source wraps an installed gem's source and sorts before other sources
# during dependency resolution. This allows RubyGems to prefer gems from
# dependency lock files.
class Gem::Source::Lock < Gem::Source
##
# The wrapped Gem::Source
attr_reader :wrapped
##
# Creates a new Lock source that wraps +source+ and moves it earlier in the
# sort list.
def initialize source
@wrapped = source
end
def <=> other # :nodoc:
case other
when Gem::Source::Lock then
@wrapped <=> other.wrapped
when Gem::Source then
1
else
nil
end
end
def == other # :nodoc:
0 == (self <=> other)
end
##
# Delegates to the wrapped source's fetch_spec method.
def fetch_spec name_tuple
@wrapped.fetch_spec name_tuple
end
def uri # :nodoc:
@wrapped.uri
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/fiber/extconf.rb
|
require 'mkmf'
create_makefile('fiber')
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/24hr_clock.rb
|
#!/usr/bin/env ruby
require 'tk'
class Clock
def initialize(clock24 = true)
@clock = (clock24)? 24: 12
@size = 200
@cdot_size = 5
@cdot_color = 'black'
@hour_hand_color = 'black'
@minute_hand_color = 'gray25'
@second_hand_color = 'gray50'
@mark_font = 'Helvetica -14'
@mark_width = 3
@mark_color = 'black'
@submark_color = 'gray50'
@c = TkCanvas.new(:width=>2*@size, :height=>2*@size,
:scrollregion=>[-@size, -@size, @size, @size]
).pack(:fill=>:both, :expand=>true)
@tag = TkcTag.new(@c)
@hand_tag = TkcTag.new(@c)
@circle_coords = [[-0.9*@size, -0.9*@size], [0.9*@size, 0.9*@size]]
@oval = TkcOval.new(@c, @circle_coords, :fill=>'white', :tags=>[@tag])
f = TkFrame.new.pack
TkLabel.new(f, :text=>'CURRENT:').pack(:side=>:left)
@now = TkLabel.new(f, :text=>'00:00:00').pack(:side=>:left, :padx=>2)
TkLabel.new(f, :text=>' ').pack(:side=>:left)
TkLabel.new(f, :text=>' ').pack(:side=>:right)
@l = TkLabel.new(f, :text=>'00:00').pack(:side=>:right, :padx=>2)
TkLabel.new(f, :text=>'MOUSE-POINTER:').pack(:side=>:right)
cmd = proc{|x, y|
@l.text = '%02d:%02d' % coords_to_time(@c.canvasx(x), @c.canvasy(y))
}
@c.bind('Motion', cmd, '%x %y')
@tag.bind('Motion', cmd, '%x %y')
_create_hands
_create_marks
timer_proc = proc{
t = Time.now
@now.text = '%02d:%02d:%02d' % [t.hour, t.min, t.sec]
set_hands(t.hour, t.min, t.sec)
}
timer_proc.call
@timer = TkRTTimer.start(100, -1, timer_proc)
end
def _create_marks
@mark_tag = TkcTag.new(@c)
TkcLine.new(@c, 0, -0.90*@size, 0, -0.85*@size,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcLine.new(@c, 0.90*@size, 0, 0.85*@size, 0,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcLine.new(@c, 0, 0.90*@size, 0, 0.85*@size,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcLine.new(@c, -0.90*@size, 0, -0.85*@size, 0,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcText.new(@c, [0, -0.92*@size], :text=>0,
:anchor=>'s', :fill=>@mark_color)
TkcText.new(@c, [0.92*@size, 0], :text=>@clock.div(4),
:anchor=>'w', :fill=>@mark_color)
TkcText.new(@c, [0, 0.92*@size], :text=>@clock.div(2),
:anchor=>'n', :fill=>@mark_color)
TkcText.new(@c, [-0.92*@size, 0], :text=>@clock.div(4)*3,
:anchor=>'e', :fill=>@mark_color)
[30.0, 60.0].each{|angle|
rad = Math::PI * angle / 180.0
x_base = @size*Math::sin(rad)
y_base = @size*Math::cos(rad)
x1 = 0.90*x_base
y1 = 0.90*y_base
x2 = 0.85*x_base
y2 = 0.85*y_base
TkcLine.new(@c, x1, y1, x2, y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcLine.new(@c, x1, -y1, x2, -y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcLine.new(@c, -x1, y1, -x2, y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
TkcLine.new(@c, -x1, -y1, -x2, -y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@mark_color)
x3 = 0.92*x_base
y3 = 0.92*y_base
if @clock == 24
dh = angle.to_i/15
else # @clock == 12
dh = angle.to_i/30
end
TkcText.new(@c, x3, -y3, :text=>dh,
:anchor=>'sw', :fill=>@mark_color)
TkcText.new(@c, x3, y3, :text=>@clock.div(2)-dh,
:anchor=>'nw', :fill=>@mark_color)
TkcText.new(@c, -x3, y3, :text=>@clock.div(2)+dh,
:anchor=>'ne', :fill=>@mark_color)
TkcText.new(@c, -x3, -y3, :text=>@clock-dh,
:anchor=>'se', :fill=>@mark_color)
}
if @clock == 24
[15.0, 45.0, 75.0].each{|angle|
rad = Math::PI * angle / 180.0
x_base = @size*Math::sin(rad)
y_base = @size*Math::cos(rad)
x1 = 0.90*x_base
y1 = 0.90*y_base
x2 = 0.875*x_base
y2 = 0.875*y_base
TkcLine.new(@c, x1, y1, x2, y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@submark_color)
TkcLine.new(@c, x1, -y1, x2, -y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@submark_color)
TkcLine.new(@c, -x1, y1, -x2, y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@submark_color)
TkcLine.new(@c, -x1, -y1, -x2, -y2,
:tags=>[@tag, @mark_tag],
:width=>@mark_width, :fill=>@submark_color)
}
end
end
def _create_hands
hour_hand_len = 0.55*@size
minute_hand_len = 0.85*@size
second_hand_len = 0.88*@size
hour_hand_width = 1.8*@cdot_size
minute_hand_width = 1.0*@cdot_size
second_hand_width = 1 # 0.4*@cdot_size
@hour_hand_coords = [
[0, -0.5*@cdot_size],
[hour_hand_width, -0.5*@cdot_size-hour_hand_width],
[hour_hand_width, -hour_hand_len+hour_hand_width],
[0, -hour_hand_len],
[-hour_hand_width, -hour_hand_len+hour_hand_width],
[-hour_hand_width, -0.5*@cdot_size-hour_hand_width],
]
@minute_hand_coords = [
[0, -0.5*@cdot_size],
[minute_hand_width, -0.5*@cdot_size - minute_hand_width],
[minute_hand_width, -minute_hand_len+minute_hand_width],
[0, -minute_hand_len],
[-minute_hand_width, -minute_hand_len+minute_hand_width],
[-minute_hand_width, -0.5*@cdot_size-minute_hand_width],
]
@second_hand_coords = [
[0, -0.5*@cdot_size],
[second_hand_width, -0.5*@cdot_size - second_hand_width],
[second_hand_width, -second_hand_len+second_hand_width],
[0, -second_hand_len],
[-second_hand_width, -second_hand_len+second_hand_width],
[-second_hand_width, -0.5*@cdot_size-second_hand_width],
]
@hour_hand = TkcPolygon.new(@c, @hour_hand_coords,
:tags=>[@tag, @hand_tag],
:outline=>@hour_hand_color,
:fill=>@hour_hand_color)
@minute_hand = TkcPolygon.new(@c, @minute_hand_coords,
:tags=>[@tag, @hand_tag],
:outline=>@minute_hand_color,
:fill=>@minute_hand_color)
@second_hand = TkcPolygon.new(@c, @second_hand_coords,
:tags=>[@tag, @hand_tag],
:outline=>@second_hand_color,
:fill=>@second_hand_color)
@center_dot = TkcOval.new(@c,
[-@cdot_size, -@cdot_size],
[@cdot_size, @cdot_size],
:outline=>@cdot_color, :fill=>@cdot_color)
end
private :_create_hands
def _raise_hands
@hour_hand.raise
@minute_hand.raise
@second_hand.raise
@center_dot.raise
end
private :_raise_hands
def _raise_marks
@mark_tag.raise
end
private :_raise_marks
def set_hands(hh, mm, ss)
ss_angle = Math::PI * ss / 30.0
mm_angle = Math::PI * (mm + ss/60.0) / 30.0
hh_angle = Math::PI * (hh + (mm + ss/60.0)/60.0) / (@clock.div(2))
@second_hand.coords = @second_hand_coords.collect{|x, y|
r = Math::hypot(y, x)
a = Math::atan2(y, x) + ss_angle
[Math::cos(a) * r, Math::sin(a) * r]
}
@minute_hand.coords = @minute_hand_coords.collect{|x, y|
r = Math::hypot(y, x)
a = Math::atan2(y, x) + mm_angle
[Math::cos(a) * r, Math::sin(a) * r]
}
@hour_hand.coords = @hour_hand_coords.collect{|x, y|
r = Math::hypot(y, x)
a = Math::atan2(y, x) + hh_angle
[Math::cos(a) * r, Math::sin(a) * r]
}
_raise_hands
_raise_marks
end
def coords_to_time(x, y)
return ((y < 0)? [0, 0]: [@clock.div(2), 0]) if x == 0
if @clock == 24
offset = (x<0&&y<0)? 1800.0: 360.0
m_half = 720.0
else # @clock == 12
offset = (x<0&&y<0)? 900.0: 180.0
m_half = 360.0
end
(offset + m_half*Math.atan2(y,x)/Math::PI).round.divmod(60)
end
def create_pie(hh, mm, span, color='red')
if @clock == 24
start = 90.0 - (hh*60 + mm)/4.0 # 360.0*(hh*60+mm)/(24*60)
extent = -span/4.0
else # @clock == 12
start = 90.0 - (hh*60 + mm)/2.0 # 360.0*(hh*60+mm)/(12*60)
extent = -span/2.0
end
pie = TkcArc.new(@c, @circle_coords, :tags=>[@tag],
:outline=>'black', 'fill'=>color,
:start=>start, :extent=>extent)
_raise_hands
_raise_marks
pie
end
end
sched = Clock.new
sched.create_pie(0,0, 60) # 60 minutes from 00:00
sched.create_pie(6,30, 280, 'green') # 280 minutes from 06:30
sched.create_pie(15,20, 90, 'blue') # 90 minutes from 15:20
Tk.mainloop
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/rdoc/test_rdoc_alias.rb
|
<gh_stars>10-100
# frozen_string_literal: false
require File.expand_path '../xref_test_case', __FILE__
class TestRDocAlias < XrefTestCase
def test_to_s
a = RDoc::Alias.new nil, 'a', 'b', ''
a.parent = @c2
assert_equal 'alias: b -> #a in: RDoc::NormalClass C2 < Object', a.to_s
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/json/parser/extconf.rb
|
<reponame>arnab0073/idea
require 'mkmf'
require 'rbconfig'
if RUBY_VERSION < "1.9"
have_header("re.h")
else
have_header("ruby/re.h")
have_header("ruby/encoding.h")
end
create_makefile 'json/ext/parser'
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
|
#
# tkextlib/tcllib/autoscroll.rb
# by <NAME> (<EMAIL>)
#
# * Part of tcllib extension
# * Provides for a scrollbar to automatically mapped and unmapped as needed
#
# (The following is the original description of the library.)
#
# This package allows scrollbars to be mapped and unmapped as needed
# depending on the size and content of the scrollbars scrolled widget.
# The scrollbar must be managed by either pack or grid, other geometry
# managers are not supported.
#
# When managed by pack, any geometry changes made in the scrollbars parent
# between the time a scrollbar is unmapped, and when it is mapped will be
# lost. It is an error to destroy any of the scrollbars siblings while the
# scrollbar is unmapped. When managed by grid, if anything becomes gridded
# in the same row and column the scrollbar occupied it will be replaced by
# the scrollbar when remapped.
#
# This package may be used on any scrollbar-like widget as long as it
# supports the set subcommand in the same style as scrollbar. If the set
# subcommand is not used then this package will have no effect.
#
require 'tk'
require 'tk/scrollbar'
require 'tkextlib/tcllib.rb'
module Tk
module Tcllib
module Autoscroll
PACKAGE_NAME = 'autoscroll'.freeze
def self.package_name
PACKAGE_NAME
end
def self.package_version
begin
TkPackage.require('autoscroll')
rescue
''
end
end
def self.not_available
fail RuntimeError, "'tkextlib/tcllib/autoscroll' extension is not available on your current environment."
end
def self.autoscroll(win)
Tk::Tcllib::Autoscroll.not_available
end
def self.unautoscroll(win)
Tk::Tcllib::Autoscroll.not_available
end
end
end
end
module Tk
module Scrollable
def autoscroll(mode = nil)
case mode
when :x, 'x'
if @xscrollbar
Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar)
end
when :y, 'y'
if @yscrollbar
Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar)
end
when nil, :both, 'both'
if @xscrollbar
Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar)
end
if @yscrollbar
Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar)
end
else
fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected"
end
self
end
def unautoscroll(mode = nil)
case mode
when :x, 'x'
if @xscrollbar
Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar)
end
when :y, 'y'
if @yscrollbar
Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar)
end
when nil, :both, 'both'
if @xscrollbar
Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar)
end
if @yscrollbar
Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar)
end
else
fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected"
end
self
end
end
end
class Tk::Scrollbar
def autoscroll
# Arranges for the already existing scrollbar to be mapped
# and unmapped as needed.
#tk_call_without_enc('::autoscroll::autoscroll', @path)
Tk::Tcllib::Autoscroll.autoscroll(self)
self
end
def unautoscroll
# Returns the scrollbar to its original static state.
#tk_call_without_enc('::autoscroll::unautoscroll', @path)
Tk::Tcllib::Autoscroll.unautoscroll(self)
self
end
end
# TkPackage.require('autoscroll', '1.0')
# TkPackage.require('autoscroll', '1.1')
TkPackage.require('autoscroll')
module Tk
module Tcllib
class << Autoscroll
undef not_available
end
module Autoscroll
extend TkCore
def self.autoscroll(win)
tk_call_without_enc('::autoscroll::autoscroll', win.path)
end
def self.unautoscroll(win)
tk_call_without_enc('::autoscroll::unautoscroll', win.path)
end
def self.wrap
# v1.1
tk_call_without_enc('::autoscroll::wrap')
end
def self.unwrap
# v1.1
tk_call_without_enc('::autoscroll::unwrap')
end
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/tkextlib/tktable/valid.rb
|
#!/usr/bin/env ruby
##
## valid.rb
##
## This demos shows the use of the validation mechanism of the table
## and uses the table's cache (no -command or -variable)
##
## ( based on 'valid.tcl' included source archive of tktable extension )
##
require 'tk'
require 'tkextlib/tktable'
rows = 10
cols = 10
def colorize(num)
num = Integer(num)
return 'colored' if (num > 0 && num % 2 == 1)
end
def fill_headers(w, r=10, c=10)
(1..(r-1)).each{|i| w.set([i,0], i.to_s)}
(1..(c-1)).each{|j|
if j % 3 == 1
w.set([0,j], 'AlphaNum')
elsif j % 2 == 1
w.set([0,j], 'Alpha')
elsif j != 0
w.set([0,j], 'Real')
end
}
end
def validate_proc(c, val)
if c % 3 == 1
# AlphaNum
regexp = /^[A-Za-z0-9 ]*$/
elsif c % 2 == 1
# Alpha
regexp = /^[A-Za-z ]*$/
elsif c != 0
# 'Real'
regexp = /^[-+]?[0-9]*\.?[0-9]*([0-9]\.?e[-+]?[0-9]*)?$/
end
if val =~ regexp
return true
else
Tk.bell
return false
end
end
lbl = TkLabel.new(:text=>"TkTable v1 Validated Table Example")
table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1,
:width=>5, :height=>5, :titlerows=>1, :titlecols=>1,
:coltagcommand=>proc{|n| colorize(n)},
:flashmode=>true, :selectmode=>:extended,
:colstretch=>:unset, :rowstretch=>:unset,
:validate=>true,
:validatecommand=>proc{|e|
unless e.widget.tag_include?('title', e.index)
validate_proc(e.column, e.new_value)
end } )
fill_headers(table)
table.tag_configure('colored', :bg=>'lightblue')
table.tag_configure('title', :fg=>'red')
table.set_width(0,3)
sx = table.xscrollbar(TkScrollbar.new)
sy = table.yscrollbar(TkScrollbar.new)
btn = TkButton.new(:text=>'Exit', :command=>proc{exit})
Tk.grid(lbl, '-', :sticky=>:ew)
Tk.grid(table, sy, :sticky=>:news)
Tk.grid(sx, :sticky=>:ew)
Tk.grid(btn, '-', :sticky=>:ew)
Tk.root.grid_columnconfig(0, :weight=>1)
Tk.root.grid_rowconfig(1, :weight=>1)
puts "Table is #{table.path}"
Tk.mainloop
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/ext/json/extconf.rb
|
# frozen_string_literal: false
require 'mkmf'
create_makefile('json')
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/tool/downloader.rb
|
require 'open-uri'
begin
require 'net/https'
rescue LoadError
https = 'http'
else
https = 'https'
# open-uri of ruby 2.2.0 accept an array of PEMs as ssl_ca_cert, but old
# versions are not. so, patching OpenSSL::X509::Store#add_file instead.
class OpenSSL::X509::Store
alias orig_add_file add_file
def add_file(pems)
Array(pems).each do |pem|
if File.directory?(pem)
add_path pem
else
orig_add_file pem
end
end
end
end
# since open-uri internally checks ssl_ca_cert by File.directory?, to allow
# accept an array.
class <<File
alias orig_directory? directory?
def File.directory? files
files.is_a?(Array) ? false : orig_directory?(files)
end
end
end
class Downloader
def self.https
if @@https != 'https'
warn "*** using http instead of https ***"
end
@@https
end
class GNU < self
def self.download(name, *rest)
if https == 'https'
super("https://raw.githubusercontent.com/gcc-mirror/gcc/master/#{name}", name, *rest)
else
super("http://repo.or.cz/official-gcc.git/blob_plain/HEAD:/#{name}", name, *rest)
end
end
end
class RubyGems < self
def self.download(name, dir = nil, ims = true, options = {})
require 'rubygems'
require 'rubygems/package'
options[:ssl_ca_cert] = Dir.glob(File.expand_path("../lib/rubygems/ssl_certs/*.pem", File.dirname(__FILE__)))
file = under(dir, name)
super("#{https}://rubygems.org/downloads/#{name}", file, nil, ims, options) or
return false
policy = Gem::Security::LowSecurity
(policy = policy.dup).ui = Gem::SilentUI.new if policy.respond_to?(:'ui=')
pkg = Gem::Package.new(file)
pkg.security_policy = policy
begin
pkg.verify
rescue Gem::Security::Exception => e
$stderr.puts e.message
File.unlink(file)
false
else
true
end
end
def self.verify(pkg)
end
end
Gems = RubyGems
class Unicode < self
def self.download(name, *rest)
super("http://www.unicode.org/Public/#{name}", name, *rest)
end
end
def self.mode_for(data)
/\A#!/ =~ data ? 0755 : 0644
end
def self.http_options(file, since)
options = {}
if since
case since
when true
since = (File.mtime(file).httpdate rescue nil)
when Time
since = since.httpdate
end
if since
options['If-Modified-Since'] = since
end
end
options['Accept-Encoding'] = '*' # to disable Net::HTTP::GenericRequest#decode_content
options
end
# Downloader.download(url, name, [dir, [ims]])
#
# Update a file from url if newer version is available.
# Creates the file if the file doesn't yet exist; however, the
# directory where the file is being created has to exist already.
# If +ims+ is false, always download url regardless of its last
# modified time.
#
# Example usage:
# download 'http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt',
# 'UnicodeData.txt', 'enc/unicode/data'
def self.download(url, name, dir = nil, ims = true, options = {})
file = under(dir, name)
if ims.nil? and File.exist?(file)
if $VERBOSE
$stdout.puts "#{name} already exists"
$stdout.flush
end
return true
end
url = URI(url)
if $VERBOSE
$stdout.print "downloading #{name} ... "
$stdout.flush
end
begin
data = url.read(options.merge(http_options(file, ims.nil? ? true : ims)))
rescue OpenURI::HTTPError => http_error
if http_error.message =~ /^304 / # 304 Not Modified
if $VERBOSE
$stdout.puts "not modified"
$stdout.flush
end
return true
end
raise
rescue Timeout::Error
if ims.nil? and File.exist?(file)
puts "Request for #{url} timed out, using old version."
return true
end
raise
rescue SocketError
if ims.nil? and File.exist?(file)
puts "No network connection, unable to download #{url}, using old version."
return true
end
raise
end
mtime = nil
open(file, "wb", 0600) do |f|
f.write(data)
f.chmod(mode_for(data))
mtime = data.meta["last-modified"]
end
if mtime
mtime = Time.httpdate(mtime)
File.utime(mtime, mtime, file)
end
if $VERBOSE
$stdout.puts "done"
$stdout.flush
end
true
rescue => e
raise "failed to download #{name}\n#{e.message}: #{url}"
end
def self.under(dir, name)
dir ? File.join(dir, File.basename(name)) : name
end
end
Downloader.class_variable_set(:@@https, https.freeze)
if $0 == __FILE__
ims = true
until ARGV.empty?
case ARGV[0]
when '-d'
destdir = ARGV[1]
ARGV.shift
when '-e'
ims = nil
when '-a'
ims = true
when /\A-/
abort "#{$0}: unknown option #{ARGV[0]}"
else
break
end
ARGV.shift
end
dl = Downloader.constants.find do |name|
ARGV[0].casecmp(name.to_s) == 0
end unless ARGV.empty?
$VERBOSE = true
if dl
dl = Downloader.const_get(dl)
ARGV.shift
ARGV.each do |name|
dl.download(name, destdir, ims)
end
else
abort "usage: #{$0} url name" unless ARGV.size == 2
Downloader.download(ARGV[0], ARGV[1], destdir, ims)
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/xenserver/requests/compute/create_vif.rb
|
module Fog
module Compute
class XenServer
class Real
def create_vif( vm_ref, network_ref, device = -1)
raise ArgumentError.new('Invalid vm_ref') if vm_ref.nil?
raise ArgumentError.new('Invalid network_ref') if network_ref.nil?
if vm_ref.is_a?(Hash)
vif_config = vm_ref.reject! { |_k,v| v.nil? }
else
vm_ref = vm_ref.reference if vm_ref.kind_of? Fog::Model
network_ref = network_ref.reference if network_ref.kind_of? Fog::Model
vif_config = default_vif_config(vm_ref, network_ref, device.to_s)
end
@connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VIF.create'}, vif_config )
end
def create_vif_custom( conf )
Fog::Logger.deprecation(
'This method is deprecated. Use #create_vif instead.'
)
raise ArgumentError.new('VIF config is not a Hash') unless conf.kind_of?(Hash)
@connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VIF.create'}, conf )
end
def default_vif_config( vm_ref, network_ref, device_number = '-1' )
Fog::Logger.deprecation(
'This method is deprecatedx.'
)
conf = {
'MAC_autogenerated' => 'True',
'VM' => vm_ref,
'network' => network_ref,
'MAC' => '',
'MTU' => '0',
'other_config' => {},
'qos_algorithm_type' => 'ratelimit',
'qos_algorithm_params' => {}
}
if device_number.to_i >= 0
conf['device'] = device_number
else
highest_dev = 0
server = servers.get vm_ref
server.vifs.each do |vif|
dev = vif.device.to_i
highest_dev = dev if dev > highest_dev
end
conf['device'] = (highest_dev + 1).to_s
end
conf
end
end
class Mock
def create_vif( vm_ref, network_ref )
Fog::Mock.not_implemented
end
end
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/test/openssl/test_ocsp.rb
|
<reponame>arnab0073/idea
# frozen_string_literal: false
require_relative "utils"
if defined?(OpenSSL::TestUtils)
class OpenSSL::TestOCSP < Test::Unit::TestCase
def setup
ca_subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCA")
ca_key = OpenSSL::TestUtils::TEST_KEY_RSA1024
ca_serial = 0xabcabcabcabc
subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCert")
@key = OpenSSL::TestUtils::TEST_KEY_RSA1024
serial = 0xabcabcabcabd
now = Time.at(Time.now.to_i) # suppress usec
dgst = OpenSSL::Digest::SHA1.new
@ca_cert = OpenSSL::TestUtils.issue_cert(
ca_subj, ca_key, ca_serial, now, now+3600, [], nil, nil, dgst)
@cert = OpenSSL::TestUtils.issue_cert(
subj, @key, serial, now, now+3600, [], @ca_cert, nil, dgst)
end
def test_new_certificate_id
cid = OpenSSL::OCSP::CertificateId.new(@cert, @ca_cert)
assert_kind_of OpenSSL::OCSP::CertificateId, cid
assert_equal @cert.serial, cid.serial
end
def test_new_certificate_id_with_digest
cid = OpenSSL::OCSP::CertificateId.new(@cert, @ca_cert, OpenSSL::Digest::SHA256.new)
assert_kind_of OpenSSL::OCSP::CertificateId, cid
assert_equal @cert.serial, cid.serial
end if defined?(OpenSSL::Digest::SHA256)
def test_new_ocsp_request
request = OpenSSL::OCSP::Request.new
cid = OpenSSL::OCSP::CertificateId.new(@cert, @ca_cert, OpenSSL::Digest::SHA1.new)
request.add_certid(cid)
request.sign(@cert, @key, [@cert])
assert_kind_of OpenSSL::OCSP::Request, request
# in current implementation not same instance of certificate id, but should contain same data
assert_equal cid.serial, request.certid.first.serial
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/fog-brightbox-0.10.1/lib/fog/brightbox/version.rb
|
module Fog
module Brightbox
VERSION = "0.10.1"
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/rdoc/ri/task.rb
|
# frozen_string_literal: false
require 'rubygems'
begin
gem 'rdoc'
rescue Gem::LoadError
end unless defined?(RDoc)
require 'rdoc/task'
##
# RDoc::RI::Task creates ri data in <code>./.rdoc</code> for your project.
#
# It contains the following tasks:
#
# [ri]
# Build ri data
#
# [clobber_ri]
# Delete ri data files. This target is automatically added to the main
# clobber target.
#
# [reri]
# Rebuild the ri data from scratch even if they are not out of date.
#
# Simple example:
#
# require 'rdoc/ri/task'
#
# RDoc::RI::Task.new do |ri|
# ri.main = 'README.rdoc'
# ri.rdoc_files.include 'README.rdoc', 'lib/**/*.rb'
# end
#
# For further configuration details see RDoc::Task.
class RDoc::RI::Task < RDoc::Task
DEFAULT_NAMES = { # :nodoc:
:clobber_rdoc => :clobber_ri,
:rdoc => :ri,
:rerdoc => :reri,
}
##
# Create an ri task with the given name. See RDoc::Task for documentation on
# setting names.
def initialize name = DEFAULT_NAMES # :yield: self
super
end
def clobber_task_description # :nodoc:
"Remove RI data files"
end
##
# Sets default task values
def defaults
super
@rdoc_dir = '.rdoc'
end
def rdoc_task_description # :nodoc:
'Build RI data files'
end
def rerdoc_task_description # :nodoc:
'Rebuild RI data files'
end
end
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/lib/cgi/html.rb
|
# frozen_string_literal: false
class CGI
# Base module for HTML-generation mixins.
#
# Provides methods for code generation for tags following
# the various DTD element types.
module TagMaker # :nodoc:
# Generate code for an element with required start and end tags.
#
# - -
def nn_element(element, attributes = {})
s = nOE_element(element, attributes)
if block_given?
s << yield.to_s
end
s << "</#{element.upcase}>"
end
def nn_element_def(attributes = {}, &block)
nn_element(__callee__, attributes, &block)
end
# Generate code for an empty element.
#
# - O EMPTY
def nOE_element(element, attributes = {})
attributes={attributes=>nil} if attributes.kind_of?(String)
s = "<#{element.upcase}"
attributes.each do|name, value|
next unless value
s << " "
s << CGI::escapeHTML(name.to_s)
if value != true
s << '="'
s << CGI::escapeHTML(value.to_s)
s << '"'
end
end
s << ">"
end
def nOE_element_def(attributes = {}, &block)
nOE_element(__callee__, attributes, &block)
end
# Generate code for an element for which the end (and possibly the
# start) tag is optional.
#
# O O or - O
def nO_element(element, attributes = {})
s = nOE_element(element, attributes)
if block_given?
s << yield.to_s
s << "</#{element.upcase}>"
end
s
end
def nO_element_def(attributes = {}, &block)
nO_element(__callee__, attributes, &block)
end
end # TagMaker
# Mixin module providing HTML generation methods.
#
# For example,
# cgi.a("http://www.example.com") { "Example" }
# # => "<A HREF=\"http://www.example.com\">Example</A>"
#
# Modules Html3, Html4, etc., contain more basic HTML-generation methods
# (+#title+, +#h1+, etc.).
#
# See class CGI for a detailed example.
#
module HtmlExtension
# Generate an Anchor element as a string.
#
# +href+ can either be a string, giving the URL
# for the HREF attribute, or it can be a hash of
# the element's attributes.
#
# The body of the element is the string returned by the no-argument
# block passed in.
#
# a("http://www.example.com") { "Example" }
# # => "<A HREF=\"http://www.example.com\">Example</A>"
#
# a("HREF" => "http://www.example.com", "TARGET" => "_top") { "Example" }
# # => "<A HREF=\"http://www.example.com\" TARGET=\"_top\">Example</A>"
#
def a(href = "") # :yield:
attributes = if href.kind_of?(String)
{ "HREF" => href }
else
href
end
super(attributes)
end
# Generate a Document Base URI element as a String.
#
# +href+ can either by a string, giving the base URL for the HREF
# attribute, or it can be a has of the element's attributes.
#
# The passed-in no-argument block is ignored.
#
# base("http://www.example.com/cgi")
# # => "<BASE HREF=\"http://www.example.com/cgi\">"
def base(href = "") # :yield:
attributes = if href.kind_of?(String)
{ "HREF" => href }
else
href
end
super(attributes)
end
# Generate a BlockQuote element as a string.
#
# +cite+ can either be a string, give the URI for the source of
# the quoted text, or a hash, giving all attributes of the element,
# or it can be omitted, in which case the element has no attributes.
#
# The body is provided by the passed-in no-argument block
#
# blockquote("http://www.example.com/quotes/foo.html") { "Foo!" }
# #=> "<BLOCKQUOTE CITE=\"http://www.example.com/quotes/foo.html\">Foo!</BLOCKQUOTE>
def blockquote(cite = {}) # :yield:
attributes = if cite.kind_of?(String)
{ "CITE" => cite }
else
cite
end
super(attributes)
end
# Generate a Table Caption element as a string.
#
# +align+ can be a string, giving the alignment of the caption
# (one of top, bottom, left, or right). It can be a hash of
# all the attributes of the element. Or it can be omitted.
#
# The body of the element is provided by the passed-in no-argument block.
#
# caption("left") { "Capital Cities" }
# # => <CAPTION ALIGN=\"left\">Capital Cities</CAPTION>
def caption(align = {}) # :yield:
attributes = if align.kind_of?(String)
{ "ALIGN" => align }
else
align
end
super(attributes)
end
# Generate a Checkbox Input element as a string.
#
# The attributes of the element can be specified as three arguments,
# +name+, +value+, and +checked+. +checked+ is a boolean value;
# if true, the CHECKED attribute will be included in the element.
#
# Alternatively, the attributes can be specified as a hash.
#
# checkbox("name")
# # = checkbox("NAME" => "name")
#
# checkbox("name", "value")
# # = checkbox("NAME" => "name", "VALUE" => "value")
#
# checkbox("name", "value", true)
# # = checkbox("NAME" => "name", "VALUE" => "value", "CHECKED" => true)
def checkbox(name = "", value = nil, checked = nil)
attributes = if name.kind_of?(String)
{ "TYPE" => "checkbox", "NAME" => name,
"VALUE" => value, "CHECKED" => checked }
else
name["TYPE"] = "checkbox"
name
end
input(attributes)
end
# Generate a sequence of checkbox elements, as a String.
#
# The checkboxes will all have the same +name+ attribute.
# Each checkbox is followed by a label.
# There will be one checkbox for each value. Each value
# can be specified as a String, which will be used both
# as the value of the VALUE attribute and as the label
# for that checkbox. A single-element array has the
# same effect.
#
# Each value can also be specified as a three-element array.
# The first element is the VALUE attribute; the second is the
# label; and the third is a boolean specifying whether this
# checkbox is CHECKED.
#
# Each value can also be specified as a two-element
# array, by omitting either the value element (defaults
# to the same as the label), or the boolean checked element
# (defaults to false).
#
# checkbox_group("name", "foo", "bar", "baz")
# # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="checkbox" NAME="name" VALUE="bar">bar
# # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
#
# checkbox_group("name", ["foo"], ["bar", true], "baz")
# # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="bar">bar
# # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
#
# checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# # <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo
# # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="2">Bar
# # <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz
#
# checkbox_group("NAME" => "name",
# "VALUES" => ["foo", "bar", "baz"])
#
# checkbox_group("NAME" => "name",
# "VALUES" => [["foo"], ["bar", true], "baz"])
#
# checkbox_group("NAME" => "name",
# "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
def checkbox_group(name = "", *values)
if name.kind_of?(Hash)
values = name["VALUES"]
name = name["NAME"]
end
values.collect{|value|
if value.kind_of?(String)
checkbox(name, value) + value
else
if value[-1] == true || value[-1] == false
checkbox(name, value[0], value[-1]) +
value[-2]
else
checkbox(name, value[0]) +
value[-1]
end
end
}.join
end
# Generate an File Upload Input element as a string.
#
# The attributes of the element can be specified as three arguments,
# +name+, +size+, and +maxlength+. +maxlength+ is the maximum length
# of the file's _name_, not of the file's _contents_.
#
# Alternatively, the attributes can be specified as a hash.
#
# See #multipart_form() for forms that include file uploads.
#
# file_field("name")
# # <INPUT TYPE="file" NAME="name" SIZE="20">
#
# file_field("name", 40)
# # <INPUT TYPE="file" NAME="name" SIZE="40">
#
# file_field("name", 40, 100)
# # <INPUT TYPE="file" NAME="name" SIZE="40" MAXLENGTH="100">
#
# file_field("NAME" => "name", "SIZE" => 40)
# # <INPUT TYPE="file" NAME="name" SIZE="40">
def file_field(name = "", size = 20, maxlength = nil)
attributes = if name.kind_of?(String)
{ "TYPE" => "file", "NAME" => name,
"SIZE" => size.to_s }
else
name["TYPE"] = "file"
name
end
attributes["MAXLENGTH"] = maxlength.to_s if maxlength
input(attributes)
end
# Generate a Form element as a string.
#
# +method+ should be either "get" or "post", and defaults to the latter.
# +action+ defaults to the current CGI script name. +enctype+
# defaults to "application/x-www-form-urlencoded".
#
# Alternatively, the attributes can be specified as a hash.
#
# See also #multipart_form() for forms that include file uploads.
#
# form{ "string" }
# # <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
#
# form("get") { "string" }
# # <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
#
# form("get", "url") { "string" }
# # <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
#
# form("METHOD" => "post", "ENCTYPE" => "enctype") { "string" }
# # <FORM METHOD="post" ENCTYPE="enctype">string</FORM>
def form(method = "post", action = script_name, enctype = "application/x-www-form-urlencoded")
attributes = if method.kind_of?(String)
{ "METHOD" => method, "ACTION" => action,
"ENCTYPE" => enctype }
else
unless method.has_key?("METHOD")
method["METHOD"] = "post"
end
unless method.has_key?("ENCTYPE")
method["ENCTYPE"] = enctype
end
method
end
if block_given?
body = yield
else
body = ""
end
if @output_hidden
body << @output_hidden.collect{|k,v|
"<INPUT TYPE=\"HIDDEN\" NAME=\"#{k}\" VALUE=\"#{v}\">"
}.join
end
super(attributes){body}
end
# Generate a Hidden Input element as a string.
#
# The attributes of the element can be specified as two arguments,
# +name+ and +value+.
#
# Alternatively, the attributes can be specified as a hash.
#
# hidden("name")
# # <INPUT TYPE="hidden" NAME="name">
#
# hidden("name", "value")
# # <INPUT TYPE="hidden" NAME="name" VALUE="value">
#
# hidden("NAME" => "name", "VALUE" => "reset", "ID" => "foo")
# # <INPUT TYPE="hidden" NAME="name" VALUE="value" ID="foo">
def hidden(name = "", value = nil)
attributes = if name.kind_of?(String)
{ "TYPE" => "hidden", "NAME" => name, "VALUE" => value }
else
name["TYPE"] = "hidden"
name
end
input(attributes)
end
# Generate a top-level HTML element as a string.
#
# The attributes of the element are specified as a hash. The
# pseudo-attribute "PRETTY" can be used to specify that the generated
# HTML string should be indented. "PRETTY" can also be specified as
# a string as the sole argument to this method. The pseudo-attribute
# "DOCTYPE", if given, is used as the leading DOCTYPE SGML tag; it
# should include the entire text of this tag, including angle brackets.
#
# The body of the html element is supplied as a block.
#
# html{ "string" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML>
#
# html("LANG" => "ja") { "string" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML>
#
# html("DOCTYPE" => false) { "string" }
# # <HTML>string</HTML>
#
# html("DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">') { "string" }
# # <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML>
#
# html("PRETTY" => " ") { "<BODY></BODY>" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# # <HTML>
# # <BODY>
# # </BODY>
# # </HTML>
#
# html("PRETTY" => "\t") { "<BODY></BODY>" }
# # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# # <HTML>
# # <BODY>
# # </BODY>
# # </HTML>
#
# html("PRETTY") { "<BODY></BODY>" }
# # = html("PRETTY" => " ") { "<BODY></BODY>" }
#
# html(if $VERBOSE then "PRETTY" end) { "HTML string" }
#
def html(attributes = {}) # :yield:
if nil == attributes
attributes = {}
elsif "PRETTY" == attributes
attributes = { "PRETTY" => true }
end
pretty = attributes.delete("PRETTY")
pretty = " " if true == pretty
buf = ""
if attributes.has_key?("DOCTYPE")
if attributes["DOCTYPE"]
buf << attributes.delete("DOCTYPE")
else
attributes.delete("DOCTYPE")
end
else
buf << doctype
end
buf << super(attributes)
if pretty
CGI::pretty(buf, pretty)
else
buf
end
end
# Generate an Image Button Input element as a string.
#
# +src+ is the URL of the image to use for the button. +name+
# is the input name. +alt+ is the alternative text for the image.
#
# Alternatively, the attributes can be specified as a hash.
#
# image_button("url")
# # <INPUT TYPE="image" SRC="url">
#
# image_button("url", "name", "string")
# # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string">
#
# image_button("SRC" => "url", "ALT" => "string")
# # <INPUT TYPE="image" SRC="url" ALT="string">
def image_button(src = "", name = nil, alt = nil)
attributes = if src.kind_of?(String)
{ "TYPE" => "image", "SRC" => src, "NAME" => name,
"ALT" => alt }
else
src["TYPE"] = "image"
src["SRC"] ||= ""
src
end
input(attributes)
end
# Generate an Image element as a string.
#
# +src+ is the URL of the image. +alt+ is the alternative text for
# the image. +width+ is the width of the image, and +height+ is
# its height.
#
# Alternatively, the attributes can be specified as a hash.
#
# img("src", "alt", 100, 50)
# # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">
#
# img("SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50)
# # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">
def img(src = "", alt = "", width = nil, height = nil)
attributes = if src.kind_of?(String)
{ "SRC" => src, "ALT" => alt }
else
src
end
attributes["WIDTH"] = width.to_s if width
attributes["HEIGHT"] = height.to_s if height
super(attributes)
end
# Generate a Form element with multipart encoding as a String.
#
# Multipart encoding is used for forms that include file uploads.
#
# +action+ is the action to perform. +enctype+ is the encoding
# type, which defaults to "multipart/form-data".
#
# Alternatively, the attributes can be specified as a hash.
#
# multipart_form{ "string" }
# # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM>
#
# multipart_form("url") { "string" }
# # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM>
def multipart_form(action = nil, enctype = "multipart/form-data")
attributes = if action == nil
{ "METHOD" => "post", "ENCTYPE" => enctype }
elsif action.kind_of?(String)
{ "METHOD" => "post", "ACTION" => action,
"ENCTYPE" => enctype }
else
unless action.has_key?("METHOD")
action["METHOD"] = "post"
end
unless action.has_key?("ENCTYPE")
action["ENCTYPE"] = enctype
end
action
end
if block_given?
form(attributes){ yield }
else
form(attributes)
end
end
# Generate a Password Input element as a string.
#
# +name+ is the name of the input field. +value+ is its default
# value. +size+ is the size of the input field display. +maxlength+
# is the maximum length of the inputted password.
#
# Alternatively, attributes can be specified as a hash.
#
# password_field("name")
# # <INPUT TYPE="password" NAME="name" SIZE="40">
#
# password_field("name", "value")
# # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40">
#
# password_field("password", "value", 80, 200)
# # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">
#
# password_field("NAME" => "name", "VALUE" => "value")
# # <INPUT TYPE="password" NAME="name" VALUE="value">
def password_field(name = "", value = nil, size = 40, maxlength = nil)
attributes = if name.kind_of?(String)
{ "TYPE" => "password", "NAME" => name,
"VALUE" => value, "SIZE" => size.to_s }
else
name["TYPE"] = "password"
name
end
attributes["MAXLENGTH"] = maxlength.to_s if maxlength
input(attributes)
end
# Generate a Select element as a string.
#
# +name+ is the name of the element. The +values+ are the options that
# can be selected from the Select menu. Each value can be a String or
# a one, two, or three-element Array. If a String or a one-element
# Array, this is both the value of that option and the text displayed for
# it. If a three-element Array, the elements are the option value, displayed
# text, and a boolean value specifying whether this option starts as selected.
# The two-element version omits either the option value (defaults to the same
# as the display text) or the boolean selected specifier (defaults to false).
#
# The attributes and options can also be specified as a hash. In this
# case, options are specified as an array of values as described above,
# with the hash key of "VALUES".
#
# popup_menu("name", "foo", "bar", "baz")
# # <SELECT NAME="name">
# # <OPTION VALUE="foo">foo</OPTION>
# # <OPTION VALUE="bar">bar</OPTION>
# # <OPTION VALUE="baz">baz</OPTION>
# # </SELECT>
#
# popup_menu("name", ["foo"], ["bar", true], "baz")
# # <SELECT NAME="name">
# # <OPTION VALUE="foo">foo</OPTION>
# # <OPTION VALUE="bar" SELECTED>bar</OPTION>
# # <OPTION VALUE="baz">baz</OPTION>
# # </SELECT>
#
# popup_menu("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# # <SELECT NAME="name">
# # <OPTION VALUE="1">Foo</OPTION>
# # <OPTION SELECTED VALUE="2">Bar</OPTION>
# # <OPTION VALUE="Baz">Baz</OPTION>
# # </SELECT>
#
# popup_menu("NAME" => "name", "SIZE" => 2, "MULTIPLE" => true,
# "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
# # <SELECT NAME="name" MULTIPLE SIZE="2">
# # <OPTION VALUE="1">Foo</OPTION>
# # <OPTION SELECTED VALUE="2">Bar</OPTION>
# # <OPTION VALUE="Baz">Baz</OPTION>
# # </SELECT>
def popup_menu(name = "", *values)
if name.kind_of?(Hash)
values = name["VALUES"]
size = name["SIZE"].to_s if name["SIZE"]
multiple = name["MULTIPLE"]
name = name["NAME"]
else
size = nil
multiple = nil
end
select({ "NAME" => name, "SIZE" => size,
"MULTIPLE" => multiple }){
values.collect{|value|
if value.kind_of?(String)
option({ "VALUE" => value }){ value }
else
if value[value.size - 1] == true
option({ "VALUE" => value[0], "SELECTED" => true }){
value[value.size - 2]
}
else
option({ "VALUE" => value[0] }){
value[value.size - 1]
}
end
end
}.join
}
end
# Generates a radio-button Input element.
#
# +name+ is the name of the input field. +value+ is the value of
# the field if checked. +checked+ specifies whether the field
# starts off checked.
#
# Alternatively, the attributes can be specified as a hash.
#
# radio_button("name", "value")
# # <INPUT TYPE="radio" NAME="name" VALUE="value">
#
# radio_button("name", "value", true)
# # <INPUT TYPE="radio" NAME="name" VALUE="value" CHECKED>
#
# radio_button("NAME" => "name", "VALUE" => "value", "ID" => "foo")
# # <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo">
def radio_button(name = "", value = nil, checked = nil)
attributes = if name.kind_of?(String)
{ "TYPE" => "radio", "NAME" => name,
"VALUE" => value, "CHECKED" => checked }
else
name["TYPE"] = "radio"
name
end
input(attributes)
end
# Generate a sequence of radio button Input elements, as a String.
#
# This works the same as #checkbox_group(). However, it is not valid
# to have more than one radiobutton in a group checked.
#
# radio_group("name", "foo", "bar", "baz")
# # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="radio" NAME="name" VALUE="bar">bar
# # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
#
# radio_group("name", ["foo"], ["bar", true], "baz")
# # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
# # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="bar">bar
# # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
#
# radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# # <INPUT TYPE="radio" NAME="name" VALUE="1">Foo
# # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="2">Bar
# # <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz
#
# radio_group("NAME" => "name",
# "VALUES" => ["foo", "bar", "baz"])
#
# radio_group("NAME" => "name",
# "VALUES" => [["foo"], ["bar", true], "baz"])
#
# radio_group("NAME" => "name",
# "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
def radio_group(name = "", *values)
if name.kind_of?(Hash)
values = name["VALUES"]
name = name["NAME"]
end
values.collect{|value|
if value.kind_of?(String)
radio_button(name, value) + value
else
if value[-1] == true || value[-1] == false
radio_button(name, value[0], value[-1]) +
value[-2]
else
radio_button(name, value[0]) +
value[-1]
end
end
}.join
end
# Generate a reset button Input element, as a String.
#
# This resets the values on a form to their initial values. +value+
# is the text displayed on the button. +name+ is the name of this button.
#
# Alternatively, the attributes can be specified as a hash.
#
# reset
# # <INPUT TYPE="reset">
#
# reset("reset")
# # <INPUT TYPE="reset" VALUE="reset">
#
# reset("VALUE" => "reset", "ID" => "foo")
# # <INPUT TYPE="reset" VALUE="reset" ID="foo">
def reset(value = nil, name = nil)
attributes = if (not value) or value.kind_of?(String)
{ "TYPE" => "reset", "VALUE" => value, "NAME" => name }
else
value["TYPE"] = "reset"
value
end
input(attributes)
end
alias scrolling_list popup_menu
# Generate a submit button Input element, as a String.
#
# +value+ is the text to display on the button. +name+ is the name
# of the input.
#
# Alternatively, the attributes can be specified as a hash.
#
# submit
# # <INPUT TYPE="submit">
#
# submit("ok")
# # <INPUT TYPE="submit" VALUE="ok">
#
# submit("ok", "button1")
# # <INPUT TYPE="submit" VALUE="ok" NAME="button1">
#
# submit("VALUE" => "ok", "NAME" => "button1", "ID" => "foo")
# # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo">
def submit(value = nil, name = nil)
attributes = if (not value) or value.kind_of?(String)
{ "TYPE" => "submit", "VALUE" => value, "NAME" => name }
else
value["TYPE"] = "submit"
value
end
input(attributes)
end
# Generate a text field Input element, as a String.
#
# +name+ is the name of the input field. +value+ is its initial
# value. +size+ is the size of the input area. +maxlength+
# is the maximum length of input accepted.
#
# Alternatively, the attributes can be specified as a hash.
#
# text_field("name")
# # <INPUT TYPE="text" NAME="name" SIZE="40">
#
# text_field("name", "value")
# # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40">
#
# text_field("name", "value", 80)
# # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80">
#
# text_field("name", "value", 80, 200)
# # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">
#
# text_field("NAME" => "name", "VALUE" => "value")
# # <INPUT TYPE="text" NAME="name" VALUE="value">
def text_field(name = "", value = nil, size = 40, maxlength = nil)
attributes = if name.kind_of?(String)
{ "TYPE" => "text", "NAME" => name, "VALUE" => value,
"SIZE" => size.to_s }
else
name["TYPE"] = "text"
name
end
attributes["MAXLENGTH"] = maxlength.to_s if maxlength
input(attributes)
end
# Generate a TextArea element, as a String.
#
# +name+ is the name of the textarea. +cols+ is the number of
# columns and +rows+ is the number of rows in the display.
#
# Alternatively, the attributes can be specified as a hash.
#
# The body is provided by the passed-in no-argument block
#
# textarea("name")
# # = textarea("NAME" => "name", "COLS" => 70, "ROWS" => 10)
#
# textarea("name", 40, 5)
# # = textarea("NAME" => "name", "COLS" => 40, "ROWS" => 5)
def textarea(name = "", cols = 70, rows = 10) # :yield:
attributes = if name.kind_of?(String)
{ "NAME" => name, "COLS" => cols.to_s,
"ROWS" => rows.to_s }
else
name
end
super(attributes)
end
end # HtmlExtension
# Mixin module for HTML version 3 generation methods.
module Html3 # :nodoc:
include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">|
end
instance_method(:nn_element_def).tap do |m|
# - -
for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG
DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV CENTER MAP
APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT TABLE TITLE
STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE
CAPTION ]
define_method(element.downcase, m)
end
end
instance_method(:nOE_element_def).tap do |m|
# - O EMPTY
for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
ISINDEX META ]
define_method(element.downcase, m)
end
end
instance_method(:nO_element_def).tap do |m|
# O O or - O
for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION TR
TH TD ]
define_method(element.downcase, m)
end
end
end # Html3
# Mixin module for HTML version 4 generation methods.
module Html4 # :nodoc:
include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|
end
# Initialize the HTML generation methods for this version.
# - -
instance_method(:nn_element_def).tap do |m|
for element in %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD
VAR CITE ABBR ACRONYM SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT
H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT OPTGROUP
FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT
TEXTAREA FORM A BLOCKQUOTE CAPTION ]
define_method(element.downcase, m)
end
end
# - O EMPTY
instance_method(:nOE_element_def).tap do |m|
for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]
define_method(element.downcase, m)
end
end
# O O or - O
instance_method(:nO_element_def).tap do |m|
for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
COLGROUP TR TH TD HEAD ]
define_method(element.downcase, m)
end
end
end # Html4
# Mixin module for HTML version 4 transitional generation methods.
module Html4Tr # :nodoc:
include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">|
end
# Initialise the HTML generation methods for this version.
# - -
instance_method(:nn_element_def).tap do |m|
for element in %w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN
CODE SAMP KBD VAR CITE ABBR ACRONYM FONT SUB SUP SPAN BDO
ADDRESS DIV CENTER MAP OBJECT APPLET H1 H2 H3 H4 H5 H6 PRE Q
INS DEL DL OL UL DIR MENU LABEL SELECT OPTGROUP FIELDSET
LEGEND BUTTON TABLE IFRAME NOFRAMES TITLE STYLE SCRIPT
NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]
define_method(element.downcase, m)
end
end
# - O EMPTY
instance_method(:nOE_element_def).tap do |m|
for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
COL ISINDEX META ]
define_method(element.downcase, m)
end
end
# O O or - O
instance_method(:nO_element_def).tap do |m|
for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
COLGROUP TR TH TD HEAD ]
define_method(element.downcase, m)
end
end
end # Html4Tr
# Mixin module for generating HTML version 4 with framesets.
module Html4Fr # :nodoc:
include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">|
end
# Initialise the HTML generation methods for this version.
# - -
instance_method(:nn_element_def).tap do |m|
for element in %w[ FRAMESET ]
define_method(element.downcase, m)
end
end
# - O EMPTY
instance_method(:nOE_element_def).tap do |m|
for element in %w[ FRAME ]
define_method(element.downcase, m)
end
end
end # Html4Fr
# Mixin module for HTML version 5 generation methods.
module Html5 # :nodoc:
include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML>|
end
# Initialise the HTML generation methods for this version.
# - -
instance_method(:nn_element_def).tap do |m|
for element in %w[ SECTION NAV ARTICLE ASIDE HGROUP HEADER
FOOTER FIGURE FIGCAPTION S TIME U MARK RUBY BDI IFRAME
VIDEO AUDIO CANVAS DATALIST OUTPUT PROGRESS METER DETAILS
SUMMARY MENU DIALOG I B SMALL EM STRONG DFN CODE SAMP KBD
VAR CITE ABBR SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT
H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT
FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT
TEXTAREA FORM A BLOCKQUOTE CAPTION ]
define_method(element.downcase, m)
end
end
# - O EMPTY
instance_method(:nOE_element_def).tap do |m|
for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META
COMMAND EMBED KEYGEN SOURCE TRACK WBR ]
define_method(element.downcase, m)
end
end
# O O or - O
instance_method(:nO_element_def).tap do |m|
for element in %w[ HTML HEAD BODY P DT DD LI OPTION THEAD TFOOT TBODY
OPTGROUP COLGROUP RT RP TR TH TD ]
define_method(element.downcase, m)
end
end
end # Html5
class HTML3
include Html3
include HtmlExtension
end
class HTML4
include Html4
include HtmlExtension
end
class HTML4Tr
include Html4Tr
include HtmlExtension
end
class HTML4Fr
include Html4Tr
include Html4Fr
include HtmlExtension
end
class HTML5
include Html5
include HtmlExtension
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/logging-2.1.0/test/appenders/test_rolling_file.rb
|
require File.expand_path('../setup', File.dirname(__FILE__))
module TestLogging
module TestAppenders
class TestRollingFile < Test::Unit::TestCase
include LoggingTestCase
NAME = 'roller'
def setup
super
Logging.init
@fn = File.expand_path('test.log', TMP)
@fn_fmt = File.expand_path('test.%d.log', TMP)
@glob = File.expand_path('*.log', TMP)
end
def test_factory_method_validates_input
assert_raise(ArgumentError) do
Logging.appenders.rolling_file
end
end
def test_initialize
assert_equal [], Dir.glob(@glob)
# create a new appender
ap = Logging.appenders.rolling_file(NAME, :filename => @fn)
assert_equal @fn, ap.filename
assert File.exist?(@fn)
assert_equal 0, File.size(@fn)
ap << "Just a line of text\n" # 20 bytes
ap.flush
assert_equal 20, File.size(@fn)
cleanup
# make sure we append to the current file (not truncate)
ap = Logging.appenders.rolling_file(NAME, :filename => @fn)
assert_equal @fn, ap.filename
assert_equal [@fn], Dir.glob(@glob)
assert_equal 20, File.size(@fn)
ap << "Just another line of text\n" # 26 bytes
ap.flush
assert_equal 46, File.size(@fn)
cleanup
# setting the truncate option to true should roll the current log file
# and create a new one
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :truncate => true)
log1 = sprintf(@fn_fmt, 1)
assert_equal [log1, @fn], Dir.glob(@glob).sort
assert_equal 0, File.size(@fn)
assert_equal 46, File.size(log1)
ap << "Some more text in the new file\n" # 31 bytes
ap.flush
assert_equal 31, File.size(@fn)
cleanup
end
def test_keep
assert_equal [], Dir.glob(@glob)
(1..12).each do |cnt|
name = sprintf(@fn_fmt, cnt)
File.open(name,'w') {|fd| fd.write 'X'*cnt}
end
FileUtils.touch(@fn)
# keep only five files
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :keep => 5)
# we still have 13 files because we did not truncate the log file,
# and hence, we did not roll all the log files
assert_equal 13, Dir.glob(@glob).length
# force the appender to roll the files
ap.send :copy_truncate
ap.instance_variable_get(:@roller).roll_files
assert_equal 6, Dir.glob(@glob).length
(1..5).each do |cnt|
name = sprintf(@fn_fmt, cnt)
assert_equal cnt-1, File.size(name)
end
cleanup
end
def test_age
d_glob = File.join(TMP, 'test.*.log')
dt_glob = File.join(TMP, 'test.*-*.log')
age_fn = @fn + '.age'
assert_equal [], Dir.glob(@glob)
assert_raise(ArgumentError) do
Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'bob')
end
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 1)
ap << "random message\n"
assert_equal 1, Dir.glob(@glob).length
now = ::File.mtime(age_fn)
start = now - 42
::File.utime(start, start, age_fn)
ap.instance_variable_set(:@age_fn_mtime, nil)
ap << "another random message\n"
assert_equal 1, Dir.glob(dt_glob).length
Dir.glob(d_glob).each {|fn| ::File.delete fn}
cleanup
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'daily')
ap << "random message\n"
assert_equal 1, Dir.glob(@glob).length
now = ::File.mtime(age_fn)
start = now - 3600 * 24
::File.utime(start, start, age_fn)
ap.instance_variable_set(:@age_fn_mtime, nil)
sleep 0.250
ap << "yet another random message\n"
assert_equal 0, Dir.glob(dt_glob).length
assert_equal 1, Dir.glob(d_glob).length
Dir.glob(d_glob).each {|fn| ::File.delete fn}
cleanup
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'weekly')
ap << "random message\n"
assert_equal 1, Dir.glob(@glob).length
start = now - 3600 * 24 * 7
::File.utime(start, start, age_fn)
ap.instance_variable_set(:@age_fn_mtime, nil)
sleep 0.250
ap << "yet another random message\n"
assert_equal 0, Dir.glob(dt_glob).length
assert_equal 1, Dir.glob(d_glob).length
Dir.glob(d_glob).each {|fn| ::File.delete fn}
cleanup
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'monthly')
ap << "random message\n"
assert_equal 1, Dir.glob(@glob).length
start = now - 3600 * 24 * 31
::File.utime(start, start, age_fn)
ap.instance_variable_set(:@age_fn_mtime, nil)
sleep 0.250
ap << "yet another random message\n"
assert_equal 0, Dir.glob(dt_glob).length
assert_equal 1, Dir.glob(d_glob).length
end
def test_size
assert_equal [], Dir.glob(@glob)
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :size => 100)
ap << 'X' * 100; ap.flush
assert_equal 1, Dir.glob(@glob).length
assert_equal 100, File.size(@fn)
# this character is appended to the log file (bringing its size to 101)
# and THEN the file is rolled resulting in a new, empty log file
ap << 'X'
assert_equal 2, Dir.glob(@glob).length
assert_equal 0, File.size(@fn)
ap << 'X' * 100; ap.flush
assert_equal 2, Dir.glob(@glob).length
assert_equal 100, File.size(@fn)
ap << 'X'
assert_equal 3, Dir.glob(@glob).length
assert_equal 0, File.size(@fn)
cleanup
end
def test_file_removed
assert_equal [], Dir.glob(@glob)
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :size => 100)
ap << 'X' * 100; ap.flush
assert_equal 1, Dir.glob(@glob).length
assert_equal 100, File.size(@fn)
end
def test_changing_directories
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :size => 100)
begin
pwd = Dir.pwd
Dir.chdir TMP
ap << 'X' * 100; ap.flush
assert_equal 1, Dir.glob(@glob).length
ap << 'X'; ap.flush
assert_equal 2, Dir.glob(@glob).length
ensure
Dir.chdir pwd
end
end
def test_stale_copy_file
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :size => 100)
fn_copy = @fn + '._copy_'
File.open(fn_copy, 'w') { |copy| copy.puts 'stale copy file' }
ap << 'X' * 100; ap.flush
assert_equal 1, Dir.glob(@glob).length
assert_equal 100, File.size(@fn)
# this character is appended to the log file (bringing its size to 101)
# but the file is NOT ROLLED because the _copy_ file is in the way
ap << 'X'
assert_equal 1, Dir.glob(@glob).length
assert_equal 101, File.size(@fn)
assert_equal 16, File.size(fn_copy)
# if the _copy_ file is older than three minutes, it will be
# concatenated to and moved out of the way
time = Time.now - 200
::File.utime(time, time, fn_copy)
ap << 'X'
assert_equal 2, Dir.glob(@glob).length
assert_equal 0, File.size(@fn)
assert_equal 118, File.size(Dir.glob(@glob).sort.first)
assert !File.exist?(fn_copy), '_copy_ file should not exist'
cleanup
end
def test_custom_numberd_filename
fn = File.expand_path('test.log{{.%d}}', TMP)
filename = File.expand_path('test.log', TMP)
glob = File.expand_path('test.log.*', TMP)
assert_equal [], Dir.glob(glob)
ap = Logging.appenders.rolling_file(NAME, :filename => fn, :size => 100, :keep => 2)
ap << 'X' * 100; ap.flush
assert_equal 0, Dir.glob(glob).length
assert_equal 100, File.size(filename)
# this character is appended to the log file (bringing its size to 101)
# and THEN the file is rolled resulting in a new, empty log file
ap << 'X'
assert_equal 1, Dir.glob(glob).length
assert_equal 0, File.size(filename)
ap << 'Y' * 100; ap.flush
assert_equal 1, Dir.glob(glob).length
assert_equal 100, File.size(filename)
ap << 'Y'
assert_equal 2, Dir.glob(glob).length
assert_equal 0, File.size(filename)
# now make sure we prune the correct file
ap << 'Z' * 101; ap.flush
files = Dir.glob(glob).sort
assert_equal 2, files.length
assert_equal 'Z'*101, ::File.read(files.first)
assert_equal 'Y'*101, ::File.read(files.last)
cleanup
end
def test_custom_timestamp_filename
fn = File.expand_path('test{{.%S:%M}}.log', TMP)
filename = File.expand_path('test.log', TMP)
age_file = filename + '.age'
glob = File.expand_path('test.*.log', TMP)
assert_equal [], Dir.glob(glob)
ap = Logging.appenders.rolling_file(NAME, :filename => fn, :age => 1, :keep => 2)
ap << "random message\n"
assert_equal 0, Dir.glob(glob).length
now = ::File.mtime(age_file)
start = now - 42
::File.utime(start, start, age_file)
ap.instance_variable_set(:@age_fn_mtime, nil)
ap << "another random message\n"
files = Dir.glob(glob)
assert_equal 1, files.length
assert_match %r/test\.\d{2}:\d{2}\.log\z/, files.first
cleanup
end
private
def cleanup
unless Logging.appenders[NAME].nil?
Logging.appenders[NAME].close false
Logging.appenders[NAME] = nil
end
end
end # TestRollingFile
end # TestAppenders
end # TestLogging
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/win32ole/sample/oledirs.rb
|
#
# You need WSH(Windows Scripting Host) to run this script.
#
require "win32ole"
def listup(items)
# items.each do |i|
for i in items
puts i.name
end
end
fs = WIN32OLE.new("Scripting.FileSystemObject")
folder = fs.GetFolder(".")
puts "--- folder of #{folder.path} ---"
listup(folder.SubFolders)
puts "--- files of #{folder.path} ---"
listup(folder.Files)
|
arnab0073/idea
|
.rvm/src/ruby-2.3.0/tool/generic_erb.rb
|
<gh_stars>0
# -*- coding: us-ascii -*-
require 'erb'
require 'optparse'
require 'fileutils'
$:.unshift(File.dirname(__FILE__))
require 'vpath'
vpath = VPath.new
timestamp = nil
output = nil
ifchange = nil
source = false
color = nil
opt = OptionParser.new do |o|
o.on('-t', '--timestamp[=PATH]') {|v| timestamp = v || true}
o.on('-o', '--output=PATH') {|v| output = v}
o.on('-c', '--[no-]if-change') {|v| ifchange = v}
o.on('-x', '--source') {source = true}
o.on('--color') {color = true}
vpath.def_options(o)
o.order!(ARGV)
end
unchanged = "unchanged"
updated = "updated"
if color or (color == nil && STDOUT.tty?)
if (/\A\e\[.*m\z/ =~ IO.popen("tput smso", "r", err: IO::NULL, &:read) rescue nil)
beg = "\e["
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
reset = "#{beg}m"
unchanged = "#{beg}#{colors["pass"] || "32;1"}m#{unchanged}#{reset}"
updated = "#{beg}#{colors["fail"] || "31;1"}m#{updated}#{reset}"
end
end
template = ARGV.shift or abort opt.to_s
erb = ERB.new(File.read(template), nil, '%-')
erb.filename = template
result = source ? erb.src : erb.result
if output
if ifchange and (vpath.open(output, "rb") {|f| f.read} rescue nil) == result
puts "#{output} #{unchanged}"
else
open(output, "wb") {|f| f.print result}
puts "#{output} #{updated}"
end
if timestamp
if timestamp == true
dir, base = File.split(output)
timestamp = File.join(dir, ".time." + base)
end
FileUtils.touch(timestamp)
end
else
print result
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/winrm-1.8.1/lib/winrm/helpers/powershell_script.rb
|
# encoding: UTF-8
#
# Copyright 2014 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
module WinRM
# Wraps a PowerShell script to make it easy to Base64 encode for transport
class PowershellScript
attr_reader :text
# Creates a new PowershellScript object which can be used to encode
# PS scripts for safe transport over WinRM.
# @param [String] The PS script text content
def initialize(script)
@text = script
end
# Encodes the script so that it can be passed to the PowerShell
# --EncodedCommand argument.
# @return [String] The UTF-16LE base64 encoded script
def encoded
encoded_script = safe_script(text).encode('UTF-16LE', 'UTF-8')
Base64.strict_encode64(encoded_script)
end
# suppress the progress stream from leaking to stderr
def safe_script(script)
"$ProgressPreference='SilentlyContinue';" + script
end
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/net-ssh-2.2.2/test/manual/test_forward.rb
|
<gh_stars>0
# $ ruby -Ilib -Itest -rrubygems test/test_forward.rb
# Tests for the following patch:
#
# http://github.com/net-ssh/net-ssh/tree/portfwfix
#
# It fixes 3 issues, regarding closing forwarded ports:
#
# 1.) if client closes a forwarded connection, but the server is reading, net-ssh terminates with IOError socket closed.
# 2.) if client force closes (RST) a forwarded connection, but server is reading, net-ssh terminates with
# 3.) if server closes the sending side, the on_eof is not handled.
#
# More info:
#
# http://net-ssh.lighthouseapp.com/projects/36253/tickets/7
require 'common'
require 'net/ssh/buffer'
require 'net/ssh'
require 'timeout'
require 'tempfile'
class TestForward < Test::Unit::TestCase
def localhost
'localhost'
end
def ssh_start_params
[localhost ,ENV['USER']] #:verbose => :debug
end
def find_free_port
server = TCPServer.open(0)
server.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR,true)
port = server.addr[1]
server.close
port
end
def start_server_sending_lot_of_data(exceptions)
server = TCPServer.open(0)
Thread.start do
loop do
Thread.start(server.accept) do |client|
begin
10000.times do |i|
client.puts "item#{i}"
end
client.close
rescue
exceptions << $!
raise
end
end
end
end
return server
end
def start_server_closing_soon(exceptions=nil)
server = TCPServer.open(0)
Thread.start do
loop do
Thread.start(server.accept) do |client|
begin
client.recv(1024)
client.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, [1, 0].pack("ii"))
client.close
rescue
exceptions << $!
raise
end
end
end
end
return server
end
def test_loop_should_not_abort_when_local_side_of_forward_is_closed
session = Net::SSH.start(*ssh_start_params)
server_exc = Queue.new
server = start_server_sending_lot_of_data(server_exc)
remote_port = server.addr[1]
local_port = find_free_port
session.forward.local(local_port, localhost, remote_port)
client_done = Queue.new
Thread.start do
begin
client = TCPSocket.new(localhost, local_port)
client.recv(1024)
client.close
sleep(0.2)
ensure
client_done << true
end
end
session.loop(0.1) { client_done.empty? }
assert_equal "Broken pipe", "#{server_exc.pop}" unless server_exc.empty?
end
def test_loop_should_not_abort_when_local_side_of_forward_is_reset
session = Net::SSH.start(*ssh_start_params)
server_exc = Queue.new
server = start_server_sending_lot_of_data(server_exc)
remote_port = server.addr[1]
local_port = find_free_port
session.forward.local(local_port, localhost, remote_port)
client_done = Queue.new
Thread.start do
begin
client = TCPSocket.new(localhost, local_port)
client.recv(1024)
client.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, [1, 0].pack("ii"))
client.close
sleep(0.1)
ensure
client_done << true
end
end
session.loop(0.1) { client_done.empty? }
assert_equal "Broken pipe", "#{server_exc.pop}" unless server_exc.empty?
end
def create_local_socket(&blk)
tempfile = Tempfile.new("net_ssh_forward_test")
path = tempfile.path
tempfile.delete
yield UNIXServer.open(path)
File.delete(path)
end
def test_forward_local_unix_socket_to_remote_port
session = Net::SSH.start(*ssh_start_params)
server_exc = Queue.new
server = start_server_sending_lot_of_data(server_exc)
remote_port = server.addr[1]
client_data = nil
create_local_socket do |local_socket|
session.forward.local(local_socket, localhost, remote_port)
client_done = Queue.new
Thread.start do
begin
client = UNIXSocket.new(local_socket.path)
client_data = client.recv(1024)
client.close
sleep(0.2)
ensure
client_done << true
end
end
session.loop(0.1) { client_done.empty? }
end
assert_not_nil(client_data, "client should have received data")
assert(client_data.match(/item\d/), 'client should have received the string item')
end
def test_loop_should_not_abort_when_server_side_of_forward_is_closed
session = Net::SSH.start(*ssh_start_params)
server = start_server_closing_soon
remote_port = server.addr[1]
local_port = find_free_port
session.forward.local(local_port, localhost, remote_port)
client_done = Queue.new
Thread.start do
begin
client = TCPSocket.new(localhost, local_port)
1.times do |i|
client.puts "item#{i}"
end
client.close
sleep(0.1)
ensure
client_done << true
end
end
session.loop(0.1) { client_done.empty? }
end
def start_server
server = TCPServer.open(0)
Thread.start do
loop do
Thread.start(server.accept) do |client|
yield(client)
end
end
end
return server
end
def test_server_eof_should_be_handled
session = Net::SSH.start(*ssh_start_params)
server = start_server do |client|
client.write "This is a small message!"
client.close
end
client_done = Queue.new
client_exception = Queue.new
client_data = Queue.new
remote_port = server.addr[1]
local_port = find_free_port
session.forward.local(local_port, localhost, remote_port)
Thread.start do
begin
client = TCPSocket.new(localhost, local_port)
data = client.read(4096)
client.close
client_done << data
rescue
client_done << $!
end
end
timeout(5) do
session.loop(0.1) { client_done.empty? }
assert_equal "This is a small message!", client_done.pop
end
end
end
|
arnab0073/idea
|
.rvm/src/ruby-1.9.3-p551/ext/tk/sample/demos-en/ctext.rb
|
<gh_stars>1-10
# ctext.rb
#
# This demonstration script creates a canvas widget with a text
# item that can be edited and reconfigured in various ways.
#
# Canvas Text widget demo (called by 'widget')
#
# toplevel widget
if defined?($ctext_demo) && $ctext_demo
$ctext_demo.destroy
$ctext_demo = nil
end
# demo toplevel widget
$ctext_demo = TkToplevel.new {|w|
title("Canvas Text Demonstration")
iconname("Text")
positionWindow(w)
}
base_frame = TkFrame.new($ctext_demo).pack(:fill=>:both, :expand=>true)
# label
TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left',
'text'=>"This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing:
1. You can point, click, and type.
2. You can also select with button 1.
3. You can copy the selection to the mouse position with button 2.
4. Backspace and Control+h delete the selection if there is one;
otherwise they delete the character just before the insertion cursor.
5. Delete deletes the selection if there is one; otherwise it deletes
the character just after the insertion cursor."){
pack('side'=>'top')
}
# frame
$ctext_buttons = TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
text 'Dismiss'
command proc{
tmppath = $ctext_demo
$ctext_demo = nil
tmppath.destroy
}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
text 'Show Code'
command proc{showCode 'ctext'}
}.pack('side'=>'left', 'expand'=>'yes')
}
$ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# canvas
$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat',
'borderwidth'=>0, 'width'=>500, 'height'=>350)
$ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both')
# font
if $tk_version =~ /^4.*/
textFont = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*'
else
textFont = 'Helvetica 24'
end
# canvas
TkcRectangle.new($ctext_canvas, 245, 195, 255, 205,
'outline'=>'black', 'fill'=>'red')
ctag_text_param = {
'text'=>"This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above).",
'width'=>440, 'anchor'=>'n', 'justify'=>'left'
}
if $tk_version =~ /^4.*/
ctag_text_param['font'] = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*'
else
ctag_text_param['font'] = 'Helvetica 24'
end
$ctag_text = TkcTag.new($ctext_canvas)
$ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200, ctag_text_param))
$ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y")
$ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y")
$ctag_text.bind('Shift-1',
proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"},
"%x %y")
$ctag_text.bind('Shift-B1-Motion',
proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y")
$ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A")
$ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"})
$ctag_text.bind('Control-h', proc{textBs $ctext_canvas})
$ctag_text.bind('BackSpace', proc{textBs $ctext_canvas})
$ctag_text.bind('Delete', proc{textDel $ctext_canvas})
$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"},
"%x %y")
# Next, create some items that allow the text's anchor position
# to be edited.
def mkTextConfig(w,x,y,option,value,color)
item = TkcRectangle.new(w, x, y, x+30, y+30,
'outline'=>'black', 'fill'=>color, 'width'=>1)
item.bind('1', proc{$ctag_text.configure option, value})
w.addtag_withtag('config', item)
end
x = 50
y = 50
color = 'LightSkyBlue1'
mkTextConfig $ctext_canvas, x, y, 'anchor', 'se', color
mkTextConfig $ctext_canvas, x+30, y, 'anchor', 's', color
mkTextConfig $ctext_canvas, x+60, y, 'anchor', 'sw', color
mkTextConfig $ctext_canvas, x, y+30, 'anchor', 'e', color
mkTextConfig $ctext_canvas, x+30, y+30, 'anchor', 'center', color
mkTextConfig $ctext_canvas, x+60, y+30, 'anchor', 'w', color
mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color
mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color
mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color
item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50,
'outline'=>'black', 'fill'=>'red')
item.bind('1', proc{$ctag_text.configure 'anchor', 'center'})
if $tk_version =~ /^4.*/
TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position',
'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
'anchor'=>'s', 'fill'=>'brown')
else
TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position',
'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown')
end
# Lastly, create some items that allow the text's justification to be
# changed.
x = 350
y = 50
color = 'SeaGreen2'
mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color
mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color
mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color
if $tk_version =~ /^4.*/
TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification',
'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
'anchor'=>'s', 'fill'=>'brown')
else
TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification',
'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown')
end
$ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas})
$ctext_canvas.itembind('config', 'Leave',
proc{$ctext_canvas\
.itemconfigure('current',
'fill'=>$textConfigFill)})
$textConfigFill = ''
def textEnter(w)
$textConfigFill = (w.itemconfiginfo 'current', 'fill')[4]
w.itemconfigure 'current', 'fill', 'black'
end
def textInsert(w, string)
return if string == ""
begin
$ctag_text.dchars 'sel.first', 'sel.last'
rescue
end
$ctag_text.insert 'insert', string
end
def textPaste(w, pos)
begin
$ctag_text.insert pos, TkSelection.get
rescue
end
end
def textB1Press(w,x,y)
w.icursor 'current', "@#{x},#{y}"
w.itemfocus 'current'
w.focus
w.select_from 'current', "@#{x},#{y}"
end
def textB1Move(w,x,y)
w.select_to 'current', "@#{x},#{y}"
end
def textBs(w)
begin
$ctag_text.dchars 'sel.first', 'sel.last'
rescue
char = $ctag_text.index('insert').to_i - 1
$ctag_text.dchars(char) if char >= 0
end
end
def textDel(w)
begin
$ctag_text.dchars 'sel.first', 'sel.last'
rescue
$ctag_text.dchars 'insert'
end
end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/net-ssh-multi-1.2.0/lib/net/ssh/multi/server_list.rb
|
<filename>.rvm/gems/ruby-2.3.0/gems/net-ssh-multi-1.2.0/lib/net/ssh/multi/server_list.rb<gh_stars>1-10
require 'net/ssh/multi/server'
require 'net/ssh/multi/dynamic_server'
module Net; module SSH; module Multi
# Encapsulates a list of server objects, both dynamic (Net::SSH::Multi::DynamicServer)
# and static (Net::SSH::Multi::Server). It attempts to make it transparent whether
# a dynamic server set has been evaluated or not. Note that a ServerList is
# NOT an Array, though it is Enumerable.
class ServerList
include Enumerable
# Create a new ServerList that wraps the given server list. Duplicate entries
# will be discarded.
def initialize(list=[])
@list = list.uniq
end
# Adds the given server to the list, and returns the argument. If an
# identical server definition already exists in the collection, the
# argument is _not_ added, and the existing server record is returned
# instead.
def add(server)
index = @list.index(server)
if index
server = @list[index]
else
@list.push(server)
end
server
end
# Adds an array (or otherwise Enumerable list) of servers to this list, by
# calling #add for each argument. Returns +self+.
def concat(servers)
servers.each { |server| add(server) }
self
end
# Iterates over each distinct server record in the collection. This will
# correctly iterate over server records instantiated by a DynamicServer
# as well, but only if the dynamic server has been "evaluated" (see
# Net::SSH::Multi::DynamicServer#evaluate!).
def each
@list.each do |server|
case server
when Server then yield server
when DynamicServer then server.each { |item| yield item }
else raise ArgumentError, "server list contains non-server: #{server.class}"
end
end
self
end
# Works exactly as Enumerable#select, but returns the result as a new
# ServerList instance.
def select
subset = @list.select { |i| yield i }
ServerList.new(subset)
end
# Returns an array of all servers in the list, with dynamic server records
# expanded. The result is an array of distinct server records (duplicates
# are removed from the result).
def flatten
result = @list.inject([]) do |aggregator, server|
case server
when Server then aggregator.push(server)
when DynamicServer then aggregator.concat(server)
else raise ArgumentError, "server list contains non-server: #{server.class}"
end
end
result.uniq
end
alias to_ary flatten
end
end; end; end
|
arnab0073/idea
|
.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/openstack/models/planning/role.rb
|
<reponame>arnab0073/idea<filename>.rvm/gems/ruby-2.3.0/gems/fog-1.29.0/lib/fog/openstack/models/planning/role.rb
require 'fog/core/model'
module Fog
module Openstack
class Planning
class Role < Fog::Model
identity :uuid
attribute :description
attribute :name
attribute :uuid
def initialize(attributes)
# Old 'connection' is renamed as service and should be used instead
prepare_service_value(attributes)
super
end
def add_to_plan(plan_uuid)
service.add_role_to_plan(plan_uuid, uuid)
end
def remove_from_plan(plan_uuid)
service.remove_role_from_plan(plan_uuid, uuid)
end
end
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.