code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
require 'logger'
log = Logger.new(STDERR)
def do_log(log)
log.debug('do_log1') { "debug" }
log.info('do_log2') { "info" }
log.warn('do_log3') { "warn" }
log.error('do_log4') { "error" }
log.fatal('do_log6') { "fatal" }
log.unknown('do_log7') { "unknown" }
end
log.level = Logger::DEBU... | Ruby |
#!/usr/bin/env ruby
require 'logger'
logfile = 'shifting.log'
# Max 3 age ... logShifting.log, logShifting.log.0, and logShifting.log.1
shift_age = 3
# Shift log file about for each 1024 bytes.
shift_size = 1024
log = Logger.new(logfile, shift_age, shift_size)
def do_log(log)
log.debug('do_log1') { 'd' * rand(100... | Ruby |
#!/usr/bin/env ruby
require 'logger'
class MyApp < Logger::Application
def initialize(a, b, c)
super('MyApp')
# Set logDevice here.
logfile = 'app.log'
self.log = logfile
self.level = INFO
# Initialize your application...
@a = a
@b = b
@c = c
end
def run
@log.info { '... | Ruby |
#! /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!(... | Ruby |
# $Id: generate.rb 25189 2009-10-02 12:04:37Z akr $
require 'optparse'
def main
mode = nil
ids1src = nil
ids2src = nil
template = nil
output = nil
parser = @parser = OptionParser.new
parser.banner = "Usage: #{File.basename($0)} --mode=MODE [--ids1src=PATH] [--ids2src=PATH] [--output=PATH]"
parser.on(... | Ruby |
off = true
ARGF.each do |line|
case line
when /RIPPER_PARAMS_DECL_BEGIN/
off = false
when /RIPPER_PARAMS_DECL_END/
exit
when /ripper/
next if off
var = line.scan(/\w+/).last or next
base = var.sub(/ripper_/, '')
puts %"\#define #{base}\t\t(parser->ripper_#{base})"
end
end
| Ruby |
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
| Ruby |
# $Id: preproc.rb 25189 2009-10-02 12:04:37Z akr $
require 'optparse'
def main
output = nil
parser = OptionParser.new
parser.banner = "Usage: #{File.basename($0)} [--output=PATH] <parse.y>"
parser.on('--output=PATH', 'An output file.') {|path|
output = path
}
parser.on('--help', 'Prints this message a... | Ruby |
#
# $Id: sexp.rb 31342 2011-04-25 02:28:49Z naruse $
#
# Copyright (c) 2004,2005 Minero Aoki
#
# This program is free software.
# You can distribute and/or modify this program under the Ruby License.
# For details of Ruby License, see ruby/COPYING.
#
require 'ripper/core'
class Ripper
# [EXPERIMENTAL]
# Parses +... | Ruby |
#
# $Id: lexer.rb 25189 2009-10-02 12:04:37Z akr $
#
# Copyright (c) 2004,2005 Minero Aoki
#
# This program is free software.
# You can distribute and/or modify this program under the Ruby License.
# For details of Ruby License, see ruby/COPYING.
#
require 'ripper/core'
class Ripper
# Tokenizes Ruby program and re... | Ruby |
#
# $Id: filter.rb 25189 2009-10-02 12:04:37Z akr $
#
# Copyright (c) 2004,2005 Minero Aoki
#
# This program is free software.
# You can distribute and/or modify this program under the Ruby License.
# For details of Ruby License, see ruby/COPYING.
#
require 'ripper/lexer'
class Ripper
# This class handles only sca... | Ruby |
#
# $Id: core.rb 25189 2009-10-02 12:04:37Z akr $
#
# Copyright (c) 2003-2005 Minero Aoki
#
# This program is free software.
# You can distribute and/or modify this program under the Ruby License.
# For details of Ruby License, see ruby/COPYING.
#
require 'ripper.so'
class Ripper
# Parses Ruby program read from _s... | Ruby |
require 'ripper/core'
require 'ripper/lexer'
require 'ripper/filter'
require 'ripper/sexp'
| Ruby |
#!ruby -s
require 'mkmf'
require 'rbconfig'
def main
unless find_executable('bison')
unless File.exist?('ripper.c') or File.exist?("#{$srcdir}/ripper.c")
Logging.message 'missing bison; abort'
return
end
end
$objs = %w(ripper.o)
$cleanfiles.concat %w(ripper.y ripper.c ripper.E ripper.outpu... | Ruby |
require 'mkmf'
dir_config("gdbm")
if have_library("gdbm", "gdbm_open") and
have_header("gdbm.h")
create_makefile("gdbm")
end
| Ruby |
require 'optparse'
require 'erb'
opt = OptionParser.new
opt.def_option('-h', 'help') {
puts opt
exit 0
}
opt_o = nil
opt.def_option('-o FILE', 'specify output file') {|filename|
opt_o = filename
}
opt_H = nil
opt.def_option('-H FILE', 'specify output header file') {|filename|
opt_H = filename
}
C_ESC = {
... | Ruby |
require 'socket.so'
class Addrinfo
# creates an Addrinfo object from the arguments.
#
# The arguments are interpreted as similar to self.
#
# Addrinfo.tcp("0.0.0.0", 4649).family_addrinfo("www.ruby-lang.org", 80)
# #=> #<Addrinfo: 221.186.184.68:80 TCP (www.ruby-lang.org:80)>
#
# Addrinfo.unix("/... | Ruby |
require 'mkmf'
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
case RUBY_PLATFORM
when /(ms|bcc)win(32|64)|mingw/
test_func = "WSACleanup"
have_library("ws2_32", "WSACleanup")
$defs << "-DHAVE_SOCKETPAIR"
when /cygwin/
test_func = "socket"
when /beos/
test_func = "socket"
have_library("net", "socket")
when /h... | Ruby |
require 'mkmf'
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
a = have_func("getlogin")
b = have_func("getpwent")
c = have_func("getgrent")
sysconfdir = RbConfig.expand(RbConfig::CONFIG["sysconfdir"].dup, "prefix"=>"", "DESTDIR"=>"")
$defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
... | Ruby |
require 'mkmf'
create_makefile('fiber')
| Ruby |
require 'mkmf'
target = "io/wait"
unless macro_defined?("DOSISH", "#include <ruby.h>")
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
have_macro("FIONREAD", [h, ioctl_h].compact)
end
if fionread
$defs << "-DFIONREAD_HEADER=\"<#{fion... | Ruby |
require 'mkmf'
target = "io/nonblock"
hdr = %w"fcntl.h"
if have_macro("O_NONBLOCK", hdr) and
(have_macro("F_GETFL", hdr) or have_macro("F_SETFL", hdr))
create_makefile(target)
end
| Ruby |
# -*- ruby -*-
_VERSION = "0.3"
Gem::Specification.new do |s|
s.name = "io-console"
s.version = _VERSION
s.date = "2011-06-24"
s.summary = "Console interface"
s.email = "nobu@ruby-lang.org"
s.description = "add console capabilities to IO instances."
s.authors = ["Nobu Nakada"]
s.require_path = %[.]
s... | Ruby |
def IO.default_console_size
[
ENV["LINES"].to_i.nonzero? || 25,
ENV["COLUMNS"].to_i.nonzero? || 80,
]
end
begin
require 'io/console'
rescue LoadError
class IO
alias console_size default_console_size
end
else
def IO.console_size
console.winsize
rescue NoMethodError
default_console_size... | Ruby |
require 'mkmf'
ok = true
hdr = nil
case
when macro_defined?("_WIN32", "")
have_func("rb_w32_map_errno", "ruby.h")
when hdr = %w"termios.h termio.h".find {|h| have_header(h)}
have_func("cfmakeraw", hdr)
when have_header(hdr = "sgtty.h")
%w"stty gtty".each {|f| have_func(f, hdr)}
else
ok = false
end
have_header(... | Ruby |
# $Id: extconf.rb 25189 2009-10-02 12:04:37Z akr $
require 'mkmf'
have_func('rb_block_call', 'ruby/ruby.h')
create_makefile 'racc/cparse'
| Ruby |
require "mkmf"
$readline_headers = ["stdio.h"]
def have_readline_header(header)
if have_header(header, &$readline_extra_check)
$readline_headers.push(header)
return true
else
return false
end
end
def have_readline_var(var)
return have_var(var, $readline_headers)
end
def have_readline_func(func)
... | Ruby |
#
# Error messages and exception class
#
module Syck
#
# Error messages
#
ERROR_NO_HEADER_NODE = "With UseHeader=false, the node Array or Hash must have elements"
ERROR_NEED_HEADER = "With UseHeader=false, the node must be an Array or Hash"
ERROR_BAD_EXPLICIT = "Unsupported explicit transfer: '%s'"
ERROR_M... | Ruby |
#
# YAML::YPath
#
warn "#{caller[0]}: YAML::YPath is deprecated" if $VERBOSE
module Syck
class YPath
attr_accessor :segments, :predicates, :flags
def initialize( str )
@segments = []
@predicates = []
@flags = nil
while str =~ /^\/?(\/|[^\/\[]+)(?:\[... | Ruby |
#
# YAML::Loader class
# .. type handling ..
#
module Syck
class Loader
TRANSFER_DOMAINS = {
'yaml.org,2002' => {},
'ruby.yaml.org,2002' => {}
}
PRIVATE_TYPES = {}
IMPLICIT_TYPES = [ 'null', 'bool', 'time', 'int', 'float' ]
end
end
| Ruby |
# -*- mode: ruby; ruby-indent-level: 4 -*- vim: sw=4
#
# Classes required by the full core typeset
#
module Syck
#
# Default private type
#
class PrivateType
def self.tag_subclasses?; false; end
verbose, $VERBOSE = $VERBOSE, nil
def initialize( type, val )
@type_id ... | Ruby |
#
# YAML::Syck module
# .. glues syck and yaml.rb together ..
#
require 'syck/basenode'
module Syck
#
# Mixin BaseNode functionality
#
class Node
include Syck::BaseNode
end
end
| Ruby |
#
# BaseEmitter
#
require 'syck/constants'
require 'syck/encoding'
require 'syck/error'
module Syck
module BaseEmitter
def options( opt = nil )
if opt
@options[opt] || DEFAULTS[opt]
else
@options
end
end
def options=( opt )
@options = opt
end
#
# Emi... | Ruby |
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
# $Id: tag.rb 27365 2010-04-16 20:31:59Z tenderlove $
#
# = yaml/tag.rb: methods for associating a taguri to a class.
#
# Author:: why the lucky stiff
#
module Syck
# A dictionary of taguris which map to
# Ruby classes.
@@tagged_classes... | Ruby |
#
# Constants used throughout the library
#
module Syck
#
# Constants
#
VERSION = '0.60'
SUPPORTED_YAML_VERSIONS = ['1.0']
#
# Parser tokens
#
WORD_CHAR = 'A-Za-z0-9'
PRINTABLE_CHAR = '-_A-Za-z0-9!?/()$\'". '
NOT_PLAIN_CHAR = '\x7f\x0-\x1f\x80-\x9f'
ESCAPE_CHAR = '[\\x00-\\x09\\x0b-\\x1f]'
INDICATOR_CHAR... | Ruby |
#
# YAML::BaseNode class
#
module Syck
#
# YAML Generic Model container
#
module BaseNode
#
# Search for YPath entry and return
# qualified nodes.
#
def select( ypath_str )
warn "#{caller[0]}: select is deprecated" if $VERBOSE
matches = ... | Ruby |
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
require 'date'
class Class
def to_yaml( opts = {} )
raise TypeError, "can't dump anonymous class %s" % self.class
end
end
class Object
yaml_as "tag:ruby.yaml.org,2002:object"
def to_yaml_style; end
undef to_yaml_properties rescue ... | Ruby |
warn "#{caller[0]}: yaml/stringio is deprecated" if $VERBOSE
#
# Limited StringIO if no core lib is available
#
begin
require 'stringio'
rescue LoadError
# StringIO based on code by MoonWolf
class StringIO
def initialize(string="")
@string=string
@pos=0
@eof=(string.... | Ruby |
#
# Handle Unicode-to-Internal conversion
#
module Syck
#
# Escape the string, condensing common escapes
#
def self.escape( value, skip = "" )
warn "#{caller[0]}: YAML.escape is deprecated" if $VERBOSE
value.gsub( /\\/, "\\\\\\" ).
gsub( /"/, "\\\"" ).
gsub( /([\x00-\x1... | Ruby |
#
# YAML::YamlNode class
#
require 'syck/basenode'
module Syck
#
# YAML Generic Model container
#
class YamlNode
include BaseNode
attr_accessor :kind, :type_id, :value, :anchor
def initialize(t, v)
@type_id = t
if Hash === v
@kind = 'map'... | Ruby |
module Syck
#
# YAML::Stream -- for emitting many documents
#
class Stream
attr_accessor :documents, :options
def initialize( opts = {} )
@options = opts
@documents = []
end
def []( i )
@documents[ i ]
end
def add( doc )
@documents << doc
end
def edit( doc_num,... | Ruby |
# $Id$
#
# = yaml/syck.rb:
#
require 'stringio'
require 'syck.so'
require 'syck/error'
require 'syck/syck'
require 'syck/tag'
require 'syck/stream'
require 'syck/constants'
require 'syck/rubytypes'
require 'syck/types'
| Ruby |
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
# $Id: syck.rb 28681 2010-07-19 04:54:06Z tenderlove $
#
# = yaml.rb: top-level module with methods for loading and parsing YAML documents
#
# Author:: why the lucky stiff
#
require 'yaml/syck'
# == YAML
#
# YAML(tm) (rhymes with 'camel') is a
# ... | Ruby |
require 'mkmf'
have_header( "st.h" )
create_makefile( "syck" )
| Ruby |
require 'fiddle.so'
require 'fiddle/function'
require 'fiddle/closure'
require 'dl' unless Object.const_defined?(:DL)
module Fiddle
# A reference to DL::CPtr
Pointer = DL::CPtr
if WINDOWS
# Returns the last win32 +Error+ of the current executing +Thread+ or nil
# if none
def self.win32_last_error
... | Ruby |
module Fiddle
class Function
# The ABI of the Function.
attr_reader :abi
end
end
| Ruby |
module Fiddle
class Closure
# the C type of the return of the FFI closure
attr_reader :ctype
# arguments of the FFI closure
attr_reader :args
# Extends Fiddle::Closure to allow for building the closure in a block
class BlockCaller < Fiddle::Closure
# == Description
#
# Co... | Ruby |
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 mis... | Ruby |
#! /usr/local/bin/ruby
# -*- ruby -*-
$extension = nil
$extstatic = nil
$force_static = nil
$install = nil
$destdir = nil
$dryrun = false
$clean = nil
$nodynamic = nil
$extinit = nil
$extobjs = nil
$extflags = ""
$extlibs = nil
$extpath = nil
$ignore = nil
$message = nil
$command_output = nil
$configure_only = false
... | Ruby |
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $
require "mkmf"
$defs << "-DHAVE_CONFIG_H"
$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha1init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
if !with_config("bundled-sha1") &&
have_lib... | Ruby |
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $
require "mkmf"
$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "rmd160init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
if !with_config("bundled-rmd160... | Ruby |
require 'mkmf'
$defs << "-DHAVE_CONFIG_H"
$INCFLAGS << " -I$(srcdir)/.."
create_makefile('digest/bubblebabble')
| Ruby |
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $
require "mkmf"
$defs << "-DHAVE_CONFIG_H"
$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "md5init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
if !with_config("bundled-md5") &&
have_libra... | Ruby |
#--
# sha2.rb - defines Digest::SHA2 class which wraps up the SHA256,
# SHA384, and SHA512 classes.
#++
# Copyright (c) 2006 Akinori MUSHA <knu@iDaemons.org>
#
# All rights reserved. You can redistribute and/or modify it under the same
# terms as Ruby.
#
# $Id: sha2.rb 31594 2011-05-16 20:52:55Z drbrain $
... | Ruby |
# $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $
# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $
require "mkmf"
$defs << "-DHAVE_CONFIG_H"
$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha2init.#{$OBJEXT}" ]
dir_config("openssl")
pkg_config("openssl")
if !with_config("bundled-sha2") &&
have_lib... | Ruby |
# == License
#
# Copyright (c) 2006 Akinori MUSHA <knu@iDaemons.org>
#
# Documentation by Akinori MUSHA
#
# All rights reserved. You can redistribute and/or modify it under
# the same terms as Ruby.
#
# $Id: hmac.rb 31594 2011-05-16 20:52:55Z drbrain $
#
warn "use of the experimetal library 'digest/hmac' is discour... | Ruby |
require 'digest.so'
module Digest
def self.const_missing(name) # :nodoc:
case name
when :SHA256, :SHA384, :SHA512
lib = 'digest/sha2.so'
else
lib = File.join('digest', name.to_s.downcase)
end
begin
require lib
rescue LoadError
raise LoadError, "library not found for c... | Ruby |
# $RoughId: extconf.rb,v 1.6 2001/07/13 15:38:27 knu Exp $
# $Id: extconf.rb 25189 2009-10-02 12:04:37Z akr $
require "mkmf"
$INSTALLFILES = {
"digest.h" => "$(HDRDIR)"
}
create_makefile("digest")
| Ruby |
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
create_makefile('objspace')
| Ruby |
#
# kconv.rb - Kanji Converter.
#
# $Id: kconv.rb 30112 2010-12-07 11:47:39Z naruse $
#
# ----
#
# kconv.rb implements the Kconv class for Kanji Converter. Additionally,
# some methods in String classes are added to allow easy conversion.
#
require 'nkf'
#
# Kanji Converter for Ruby.
#
module Kconv
#
# Public Co... | Ruby |
require 'mkmf'
create_makefile('nkf')
| Ruby |
require 'mkmf'
dir_config("dbm")
if dblib = with_config("dbm-type", nil)
dblib = dblib.split(/[ ,]+/)
else
dblib = %w(libc db db2 db1 db5 db4 db3 dbm gdbm gdbm_compat qdbm)
end
headers = {
"libc" => ["ndbm.h"], # 4.4BSD libc contains Berkeley DB 1.
"db" => ["db.h"],
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h... | Ruby |
# $RoughId: extconf.rb,v 1.3 2001/11/24 17:49:26 knu Exp $
# $Id: extconf.rb 25189 2009-10-02 12:04:37Z akr $
require 'mkmf'
have_header("syslog.h") &&
have_func("openlog") &&
have_func("setlogmask") &&
create_makefile("syslog")
| Ruby |
=begin
= $RCSfile$ -- Loader for all OpenSSL C-space and Ruby-space definitions
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
All rights reserved.
= Licence
This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
= Version
$Id: openss... | Ruby |
#--
#
# $RCSfile$
#
# = Ruby-space definitions that completes C-space funcs for BN
#
# = Info
# 'OpenSSL for Ruby 2' project
# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
# All rights reserved.
#
# = Licence
# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
#
# = Versio... | Ruby |
#--
#
# $RCSfile$
#
# = Ruby-space predefined Cipher subclasses
#
# = Info
# 'OpenSSL for Ruby 2' project
# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
# All rights reserved.
#
# = Licence
# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
#
# = Version
# $Id: cipher.rb ... | Ruby |
warn 'deprecated openssl/x509 use: require "openssl" instead of "openssl/x509"'
require 'openssl'
| Ruby |
=begin
= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for SSL
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
All rights reserved.
= Licence
This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
= Version
$Id: ssl... | Ruby |
=begin
= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for X509 and subclasses
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
All rights reserved.
= Licence
This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
= Ver... | Ruby |
warn 'deprecated openssl/ssl use: require "openssl" instead of "openssl/ssl"'
require 'openssl'
| Ruby |
=begin
= $RCSfile$ -- Buffering mix-in module.
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
All rights reserved.
= Licence
This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
= Version
$Id: buffering.rb 34534 2012-02-10 17:27:22... | Ruby |
#--
#
# $RCSfile$
#
# = Ruby-space predefined Digest subclasses
#
# = Info
# 'OpenSSL for Ruby 2' project
# Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
# All rights reserved.
#
# = Licence
# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
#
# = Version
# $Id: digest.rb ... | Ruby |
=begin
= Ruby-space definitions that completes C-space funcs for Config
= Info
Copyright (C) 2010 Hiroshi Nakamura <nahi@ruby-lang.org>
= Licence
This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
=end
require 'stringio'
module OpenSSL
class Config
include Enumerable
... | Ruby |
=begin
= $RCSfile$ -- Generator for Makefile
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
All rights reserved.
= Licence
This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
= Version
$Id: extconf.rb 36929 2012-09-09 06:39:23Z kos... | Ruby |
require "mkmf"
create_makefile "mathn/complex"
| Ruby |
require "mkmf"
create_makefile "mathn/rational"
| Ruby |
require 'mkmf'
create_makefile('stringio')
| Ruby |
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/generator'
| Ruby |
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'
| Ruby |
##
# = JavaScript Object Notation (JSON)
#
# JSON is a lightweight data-interchange format. It is easy for us
# humans to read and write. Plus, equally simple for machines to generate or parse.
# JSON is completely language agnostic, making it the ideal interchange format.
#
# Built on two universally available structu... | Ruby |
require 'json/version'
module JSON
class << self
# If _object_ is string-like, parse the string and return the parsed result
# as a Ruby data structure. Otherwise generate a JSON text from the Ruby
# data structure object and return it.
#
# The _opts_ argument is passed through to generate/parse ... | Ruby |
require 'json/common'
module JSON
# This module holds all the modules/classes that implement JSON's
# functionality as C extensions.
module Ext
require 'json/ext/parser'
require 'json/ext/generator'
$DEBUG and warn "Using Ext extension for JSON."
JSON.parser = Parser
JSON.generator = Generato... | Ruby |
# This file contains implementations of ruby core's custom objects for
# serialisation/deserialisation.
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
require 'date'
# Symbol serialization/deserialization
class Symbol
# Returns a hash, that will be turned into a JSON object and re... | Ruby |
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
defined?(::Rational) or require 'rational'
class Rational
def self.json_create(object)
Rational(object['n'], object['d'])
end
def as_json(*)
{
JSON.create_id => self.class.name,
'n' => numerator,
... | Ruby |
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
defined?(::Complex) or require 'complex'
class Complex
def self.json_create(object)
Complex(object['r'], object['i'])
end
def as_json(*)
{
JSON.create_id => self.class.name,
'r' => real,
'i' ... | Ruby |
module JSON
# JSON version
VERSION = '1.5.4'
VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
end
| Ruby |
require 'mkmf'
create_makefile('json')
| Ruby |
require 'win32ole'
# -4100 is the value for the Excel constant xl3DColumn.
ChartTypeVal = -4100;
# Creates OLE object to Excel
#excel = WIN32OLE.new("excel.application.5")
excel = WIN32OLE.new("excel.application")
# Create and rotate the chart
excel.visible = TRUE;
excel.Workbooks.Add();
excel.Range("a1").value... | Ruby |
require 'win32ole'
class IEHandler
attr_reader :loop
def initialize
@urls = []
@loop = true
end
def method_missing(event, *args)
case event
when "BeforeNavigate2"
puts "Now Navigate #{args[1]}..."
end
end
def onNavigateComplete2(pdisp, url)
@urls << url
end
def onOnQuit
... | Ruby |
require 'win32ole'
application = WIN32OLE.new('Excel.Application')
application.visible = TRUE
workbook = application.Workbooks.Add();
worksheet = workbook.Worksheets(1);
=begin
worksheet.Range("A1:D1").value = ["North","South","East","West"];
worksheet.Range("A2:B2").value = [5.2, 10];
worksheet.Range("C2").value =... | Ruby |
#-----------------------------
# olegen.rb
# $Revision: 25189 $
#-----------------------------
require 'win32ole'
class WIN32COMGen
def initialize(typelib)
@typelib = typelib
@reciever = ""
end
attr_reader :typelib
def ole_classes(typelib)
begin
@ole = WIN32OLE.new(typelib)
[@ole.ole_... | Ruby |
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 = TRU... | Ruby |
require 'win32ole'
url = 'http://www.ruby-lang.org/'
ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = TRUE
ie.gohome
print "Now navigate Ruby home page... Please enter."
gets
ie.navigate(url)
print "Now quit Internet Explorer... Please enter."
gets
ie.Quit()
| Ruby |
#
# 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 "---... | Ruby |
require 'win32ole'
ie = WIN32OLE.new('InternetExplorer.Application')
=begin
WIN32OLE.const_load(ie)
WIN32OLE.constants.sort.each do |c|
puts "#{c} = #{WIN32OLE.const_get(c)}"
end
=end
module IE_CONST
end
WIN32OLE.const_load(ie, IE_CONST)
IE_CONST.constants.sort.each do |c|
puts "#{c} = #{IE_CONST.const_get(c)}"
... | Ruby |
require 'win32ole'
#application = WIN32OLE.new('Excel.Application.5')
application = WIN32OLE.new('Excel.Application')
application.visible = TRUE
workbook = application.Workbooks.Add();
sheet = workbook.Worksheets(1);
sheetS = workbook.Worksheets
puts "The number of sheets is #{sheetS.count}"
puts "Now add 2 sheets af... | Ruby |
#
# 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 --- versio... | Ruby |
# OLEProperty
# helper class of Property with arguments.
class OLEProperty
def initialize(obj, dispid, gettypes, settypes)
@obj = obj
@dispid = dispid
@gettypes = gettypes
@settypes = settypes
end
def [](*args)
@obj._getproperty(@dispid, args, @gettypes)
end
def []=(*args)
@obj._setpro... | Ruby |
require 'win32ole.so'
# re-define Thread#initialize
# bug #2618(ruby-core:27634)
class Thread
alias :org_initialize :initialize
def initialize(*arg, &block)
if block
org_initialize(*arg) {
WIN32OLE.ole_initialize
begin
block.call(*arg)
ensure
WIN32OLE.ole_unin... | Ruby |
#----------------------------------
# extconf.rb
# $Revision: 31121 $
#----------------------------------
require 'mkmf'
case RUBY_PLATFORM
when /cygwin/
inc = nil
lib = '/usr/lib/w32api'
end
dir_config("win32", inc, lib)
def create_win32ole_makefile
if have_library("ole32") and
have_library("oleaut32") a... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.