code
stringlengths
1
1.73M
language
stringclasses
1 value
require 'profiler' END { Profiler__::print_profile(STDERR) } Profiler__::start_profile
Ruby
=begin # # benchmark.rb - a performance benchmarking library # # $Id: benchmark.rb 15425 2008-02-10 15:24:56Z naruse $ # # Created by Gotoken (gotoken@notwork.org). # # Documentation by Gotoken (original RD), Lyle Johnson (RDoc conversion), and # Gavin Sinclair (editing). # =end # == Overview # # The Benchmark mo...
Ruby
# # tracer.rb - # $Release Version: 0.2$ # $Revision: 1.8 $ # $Date: 1998/05/19 03:42:49 $ # by Keiju ISHITSUKA(Nippon Rational Inc.) # # -- # # # # # tracer main class # class Tracer @RCS_ID='-$Id: tracer.rb,v 1.8 1998/05/19 03:42:49 keiju Exp keiju $-' @stdout = STDOUT @verbose = false cla...
Ruby
require 'uri' require 'stringio' require 'time' module Kernel private alias open_uri_original_open open # :nodoc: # makes possible to open various resources including URIs. # If the first argument respond to `open' method, # the method is called with the rest arguments. # # If the first argument is a st...
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'runit/testcase' require 'test/unit'
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. module RUNIT module ToPublic end end
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'runit/testresult' require 'runit/testsuite' require 'runit/assert' require 'runit/error' require 'test/unit/testcase' module RUNIT class TestCase < Test::Unit::TestCase ...
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'test/unit/testsuite' module RUNIT class TestSuite < Test::Unit::TestSuite def add_test(*args) add(*args) end def add(*args) self.<<(*args) e...
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'test/unit/assertionfailederror.rb' module RUNIT AssertionFailedError = Test::Unit::AssertionFailedError end
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'test/unit/testresult' module RUNIT class TestResult < Test::Unit::TestResult attr_reader(:errors, :failures) def succeed? return passed? end def failur...
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'test/unit/assertions' require 'runit/error' module RUNIT module Assert include Test::Unit::Assertions def setup_assert end def assert_no_exception(*args, &...
Ruby
# Author:: Nathaniel Talbott. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # License:: Ruby license. require 'test/unit/ui/console/testrunner' require 'runit/testresult' module RUNIT module CUI class TestRunner < Test::Unit::UI::Console::TestRunner @@quiet_mode = false ...
Ruby
# jcode.rb - ruby code to handle japanese (EUC/SJIS) string if $VERBOSE && $KCODE == "NONE" warn "Warning: $KCODE is NONE." end $vsave, $VERBOSE = $VERBOSE, false class String warn "feel free for some warnings:\n" if $VERBOSE def _regex_quote(str) str.gsub(/(\\[\[\]\-\\])|\\(.)|([\[\]\\])/) do $1 || ...
Ruby
# $Id$ # This class implements a pretty printing algorithm. It finds line breaks and # nice indentations for grouped structure. # # By default, the class assumes that primitive elements are strings and each # byte in the strings have single column in width. But it can be used for # other situations by giving suitable...
Ruby
require "delegate" # WeakRef is a class to represent a reference to an object that is not seen by # the tracing phase of the garbage collector. This allows the referenced # object to be garbage collected as if nothing is referring to it. Because # WeakRef delegates method calls to the referenced object, it may be use...
Ruby
# = delegate -- Support for the Delegation Pattern # # Documentation by James Edward Gray II and Gavin Sinclair # # == Introduction # # This library provides three different ways to delegate method calls to an # object. The easiest to use is SimpleDelegator. Pass an object to the # constructor and all methods support...
Ruby
# for ruby-1.8.0 module DRb class DRbServer module InvokeMethod18Mixin def block_yield(x) if x.size == 1 && x[0].class == Array x[0] = DRbArray.new(x[0]) end block_value = @block.call(*x) end def perform_with_block @obj.__send__(@msg_id, *@argv) do |*x| jum...
Ruby
require 'socket' require 'openssl' require 'drb/drb' require 'singleton' module DRb class DRbSSLSocket < DRbTCPSocket class SSLConfig DEFAULT = { :SSLCertificate => nil, :SSLPrivateKey => nil, :SSLClientCA => nil, :SSLCACertificatePath => nil, :SSLCACertificateFile => nil, :S...
Ruby
require 'observer' module DRb module DRbObservable include Observable def notify_observers(*arg) if defined? @observer_state and @observer_state if defined? @observer_peers for i in @observer_peers.dup begin i.update(*arg) rescue delete_observer(i) end end end @ob...
Ruby
require 'drb/drb' module DRb class DRbObject def ==(other) return false unless DRbObject === other (@ref == other.__drbref) && (@uri == other.__drburi) end def hash [@uri, @ref].hash end alias eql? == end end
Ruby
# # = drb/drb.rb # # Distributed Ruby: _dRuby_ version 2.0.4 # # Copyright (c) 1999-2003 Masatoshi SEKI. You can redistribute it and/or # modify it under the same terms as Ruby. # # Author:: Masatoshi SEKI # # Documentation:: William Webber (william@williamwebber.com) # # == Overview # # dRuby is a distributed object ...
Ruby
# acl-2.0 - simple Access Control List # # Copyright (c) 2000,2002,2003 Masatoshi SEKI # # acl.rb is copyrighted free software by Masatoshi SEKI. # You can redistribute it and/or modify it under the same terms as Ruby. require 'ipaddr' class ACL VERSION=["2.0.0"] class ACLEntry def initialize(str) if st...
Ruby
=begin external service Copyright (c) 2000,2002 Masatoshi SEKI =end require 'drb/drb' module DRb class ExtServ include DRbUndumped def initialize(there, name, server=nil) @server = server || DRb::primary_server @name = name ro = DRbObject.new(nil, there) @invoker = ro.regist(nam...
Ruby
require 'socket' require 'drb/drb' require 'tmpdir' raise(LoadError, "UNIXServer is required") unless defined?(UNIXServer) module DRb class DRbUNIXSocket < DRbTCPSocket def self.parse_uri(uri) if /^drbunix:(.*?)(\?(.*))?$/ =~ uri filename = $1 option = $3 [filename, option] else raise(DRbBadSc...
Ruby
require 'drb/drb' require 'monitor' module DRb class GWIdConv < DRbIdConv def to_obj(ref) if Array === ref && ref[0] == :DRbObject return DRbObject.new_with(ref[1], ref[2]) end super(ref) end end class GW include MonitorMixin def initialize super() @hash = {...
Ruby
require 'drb/drb' require 'monitor' module DRb class TimerIdConv < DRbIdConv class TimerHolder2 include MonitorMixin class InvalidIndexError < RuntimeError; end def initialize(timeout=600) super() @sentinel = Object.new @gc = {} @curr = {} @renew = {} @timeout = timeout @keeper = keepe...
Ruby
=begin external service manager Copyright (c) 2000 Masatoshi SEKI =end require 'drb/drb' require 'thread' require 'monitor' module DRb class ExtServManager include DRbUndumped include MonitorMixin @@command = {} def self.command @@command end def self.command=(cmd) @@comma...
Ruby
# Include the English library file in a Ruby script, and you can # reference the global variables such as \VAR{\$\_} using less # cryptic names, listed in the following table.% \vref{tab:english}. # # Without 'English': # # $\ = ' -- ' # "waterbuffalo" =~ /buff/ # print $", $', $$, "\n" # # With Eng...
Ruby
# date2 was overridden by date. # To be precise, date was overridden by date2, # and date2 was renamed to date. require 'date'
Ruby
#!/usr/bin/env ruby #-- # tsort.rb - provides a module for topological sorting and strongly connected components. #++ # # # TSort implements topological sorting using Tarjan's algorithm for # strongly connected components. # # TSort is designed to be able to be used with any object which can be # interpreted as a dire...
Ruby
# # $originalId: parser.rb,v 1.8 2006/07/06 11:42:07 aamine Exp $ # # Copyright (c) 1999-2006 Minero Aoki # # This program is free software. # You can distribute/modify this program under the same terms of ruby. # # As a special exception, when this code is copied by Racc # into a Racc output file, you may use that out...
Ruby
#!/usr/bin/env ruby #-- # $Idaemons: /home/cvs/rb/generator.rb,v 1.8 2001/10/03 08:54:32 knu Exp $ # $RoughId: generator.rb,v 1.10 2003/10/14 19:36:58 knu Exp $ # $Id: generator.rb 15954 2008-04-10 10:52:50Z knu $ #++ # # = generator.rb: convert an internal iterator to an external one # # Copyright (c) 2001,2003 Akinor...
Ruby
# # NOTE: # This file is overwritten by ext/thread/lib/thread.rb unless ruby # is configured with --disable-fastthread. # # thread.rb - thread support classes # $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $ # by Yukihiro Matsumoto <matz@netlab.co.jp> # # Copyright (C) 2001 Yukihiro Matsumoto # Copyrig...
Ruby
# # rational.rb - # $Release Version: 0.5 $ # $Revision: 1.7 $ # $Date: 1999/08/24 12:49:28 $ # by Keiju ISHITSUKA(SHL Japan Inc.) # # Documentation by Kevin Jackson and Gavin Sinclair. # # When you <tt>require 'rational'</tt>, all interactions between numbers # potentially return a rational ...
Ruby
# # = ostruct.rb: OpenStruct implementation # # Author:: Yukihiro Matsumoto # Documentation:: Gavin Sinclair # # OpenStruct allows the creation of data objects with arbitrary attributes. # See OpenStruct for an example. # # # OpenStruct allows you to create data objects and set arbitrary attributes. # For example: # #...
Ruby
# # = pathname.rb # # Object-Oriented Pathname Class # # Author:: Tanaka Akira <akr@m17n.org> # Documentation:: Author and Gavin Sinclair # # For documentation, see class Pathname. # # <tt>pathname.rb</tt> is distributed with Ruby since 1.8.0. # # # == Pathname # # Pathname represents a pathname which locates a file i...
Ruby
# # == Introduction # # This library extends the Time class: # * conversion between date string and time object. # * date-time defined by RFC 2822 # * HTTP-date defined by RFC 2616 # * dateTime defined by XML Schema Part 2: Datatypes (ISO 8601) # * various formats handled by Date._parse (string to time only) ...
Ruby
module Profiler__ # internal values @@start = @@stack = @@map = nil PROFILE_PROC = proc{|event, file, line, id, binding, klass| case event when "call", "c-call" now = Process.times[0] @@stack.push [now, 0.0] when "return", "c-return" now = Process.times[0] key = [klass, id] ...
Ruby
# SOAP4R - SOAP WSDL driver # Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. ...
Ruby
# SOAP4R - Marshalling/Unmarshalling Ruby's object using SOAP Encoding. # Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license ver...
Ruby
# SOAP4R - HTTP config loader. # Copyright (C) 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. require '...
Ruby
# SOAP4R - SOAP elements library # Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later v...
Ruby
# SOAP4R - Ruby type mapping utility. # Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. re...
Ruby
# SOAP4R - RPC element definition. # Copyright (C) 2000, 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any late...
Ruby
# SOAP4R - RPC Routing library # Copyright (C) 2001, 2002, 2004, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ve...
Ruby
# SOAP4R - WEBrick Server # Copyright (C) 2003 by NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. require 'soa...
Ruby
# SOAP4R - SOAP handler servlet for WEBrick # Copyright (C) 2001-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ve...
Ruby
# SOAP4R - RPC utility. # Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. module SOAP mo...
Ruby
# SOAP4R - RPC Proxy library. # Copyright (C) 2000, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. ...
Ruby
# SOAP4R - CGI/mod_ruby stub library # Copyright (C) 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ver...
Ruby
# SOAP4R - SOAP RPC driver # Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version...
Ruby
# SOAP4R - WEBrick HTTP Server # Copyright (C) 2003, 2004 by NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. r...
Ruby
# SOAP4R - Stream handler. # Copyright (C) 2000, 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. r...
Ruby
# SOAP4R - WSDL literal mapping registry. # Copyright (C) 2004, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ver...
Ruby
# SOAP4R - WSDL encoded mapping registry. # Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any late...
Ruby
# SOAP4R - Ruby type mapping utility. # Copyright (C) 2000, 2001, 2003-2005 NAKAMURA Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any lat...
Ruby
# SOAP4R - Mapping registry. # Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later vers...
Ruby
# SOAP4R - Base type mapping definition # Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any...
Ruby
# SOAP4R - Mapping factory. # Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later versi...
Ruby
# SOAP4R - Ruby type mapping factory. # Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ve...
Ruby
# SOAP4R - SOAP XML Instance Parser library. # Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ...
Ruby
# soap/property.rb: SOAP4R - Property implementation. # Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any lat...
Ruby
# soap/soap.rb: SOAP4R - Base definitions. # Copyright (C) 2000-2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ver...
Ruby
# SOAP4R - marshal/unmarshal interface. # Copyright (C) 2000, 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later...
Ruby
# SOAP4R - net/http wrapper # Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. require 'net...
Ruby
# SOAP4R - SOAP XML Instance Generator library. # Copyright (C) 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or a...
Ruby
# soap/baseData.rb: SOAP4R - Base type library # Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, ...
Ruby
# soap/attachment.rb: SOAP4R - SwA implementation. # Copyright (C) 2002, 2003 Jamie Herre and NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version ...
Ruby
# SOAP4R - SOAP EncodingStyle handler library # Copyright (C) 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any...
Ruby
# SOAP4R - EncodingStyle handler library # Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later vers...
Ruby
# SOAP4R - ASP.NET EncodingStyle handler library # Copyright (C) 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or ...
Ruby
# SOAP4R - XML Literal EncodingStyle handler library # Copyright (C) 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, ...
Ruby
# SOAP4R - SOAP Header handler set # Copyright (C) 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. ...
Ruby
# SOAP4R - SOAP Header handler item # Copyright (C) 2003, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. ...
Ruby
# SOAP4R - SOAP Simple header item handler # Copyright (C) 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later ver...
Ruby
# SOAP4R - MIME Message implementation. # Copyright (C) 2002 Jamie Herre. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; # either the dual license version in 2003, or any later version. require 'soap/attachment' ...
Ruby
#!/usr/bin/env ruby =begin # # Copyright (c) 2001,2003 Akinori MUSHA <knu@iDaemons.org> # # All rights reserved. You can redistribute and/or modify it under # the same terms as Ruby. # # $Idaemons: /home/cvs/rb/abbrev.rb,v 1.2 2001/05/30 09:37:45 knu Exp $ # $RoughId: abbrev.rb,v 1.4 2003/10/14 19:45:42 knu Exp $ # $I...
Ruby
# # = ftools.rb: Extra tools for the File class # # Author:: WATANABE, Hirofumi # Documentation:: Zachary Landau # # This library can be distributed under the terms of the Ruby license. # You can freely distribute/modify this library. # # It is included in the Ruby standard library. # # == Description # # ftools adds ...
Ruby
# # e2mmap.rb - for ruby 1.1 # $Release Version: 2.0$ # $Revision: 1.10 $ # $Date: 1999/02/17 12:33:17 $ # by Keiju ISHITSUKA # # -- # Usage: # # U1) # class Foo # extend Exception2MessageMapper # def_e2message ExistingExceptionClass, "message..." # def_exception :NewExceptionClass, "messa...
Ruby
# # date.rb - date and time library # # Author: Tadayoshi Funaba 1998-2010 # # Documentation: William Webber <william@williamwebber.com> # #-- # $Id: date.rb,v 2.37 2008-01-17 20:16:31+09 tadf Exp $ #++ # # == Overview # # This file provides two classes for working with # dates and times. # # The first class, Date, rep...
Ruby
#!/usr/local/bin/ruby #-- # matrix.rb - # $Release Version: 1.0$ # $Revision: 1.11 $ # $Date: 1999/10/06 11:01:53 $ # Original Version from Smalltalk-80 version # on July 23, 1985 at 8:37:17 am # by Keiju ISHITSUKA #++ # # = matrix.rb # # An implementation of Matrix and Vector ...
Ruby
require "rss/0.9" module RSS class Rss class Channel [ ["generator"], ["ttl", :integer], ].each do |name, type| install_text_element(name, "", "?", name, type) end [ %w(category categories), ].each do |name, plural_name| install_have_child...
Ruby
require "rss/parser" module RSS module RSS09 NSPOOL = {} ELEMENTS = [] def self.append_features(klass) super klass.install_must_call_validator('', "") end end class Rss < Element include RSS09 include RootElementMixin %w(channel).each do |name| install_ha...
Ruby
require "time" class Time class << self unless respond_to?(:w3cdtf) def w3cdtf(date) if /\A\s* (-?\d+)-(\d\d)-(\d\d) (?:T (\d\d):(\d\d)(?::(\d\d))? (\.\d+)? (Z|[+-]\d\d:\d\d)?)? \s*\z/ix =~ date and (($5 and $8) or (!$5 and !$8...
Ruby
require 'rss/1.0' require 'rss/dublincore' module RSS IMAGE_PREFIX = 'image' IMAGE_URI = 'http://purl.org/rss/1.0/modules/image/' RDF.install_ns(IMAGE_PREFIX, IMAGE_URI) IMAGE_ELEMENTS = [] %w(item favicon).each do |name| class_name = Utils.to_class_name(name) BaseListener.install_class_name(IMAG...
Ruby
require "rss/2.0" require "rss/dublincore" module RSS Rss.install_ns(DC_PREFIX, DC_URI) class Rss class Channel include DublinCoreModel class Item; include DublinCoreModel; end end end end
Ruby
require "rss/atom" require "rss/dublincore" module RSS module Atom Feed.install_ns(DC_PREFIX, DC_URI) class Feed include DublinCoreModel class Entry; include DublinCoreModel; end end class Entry include DublinCoreModel end end end
Ruby
require "rss/1.0" require "rss/dublincore" module RSS RDF.install_ns(DC_PREFIX, DC_URI) class RDF class Channel; include DublinCoreModel; end class Image; include DublinCoreModel; end class Item; include DublinCoreModel; end class Textinput; include DublinCoreModel; end end end
Ruby
begin require "xml/parser" rescue LoadError require "xmlparser" end begin require "xml/encoding-ja" rescue LoadError require "xmlencoding-ja" if defined?(Kconv) module XMLEncoding_ja class SJISHandler include Kconv end end end end module XML class Parser unless defined?(E...
Ruby
require "rss/2.0" require "rss/content" module RSS Rss.install_ns(CONTENT_PREFIX, CONTENT_URI) class Rss class Channel class Item; include ContentModel; end end end end
Ruby
require 'rss/1.0' require 'rss/content' module RSS RDF.install_ns(CONTENT_PREFIX, CONTENT_URI) class RDF class Item; include ContentModel; end end end
Ruby
require "rss/rss" module RSS CONTENT_PREFIX = 'content' CONTENT_URI = "http://purl.org/rss/1.0/modules/content/" module ContentModel extend BaseModel ELEMENTS = ["#{CONTENT_PREFIX}_encoded"] def self.append_features(klass) super klass.install_must_call_validator(CONTENT_PREFIX, CONTEN...
Ruby
require 'rss/1.0' module RSS SLASH_PREFIX = 'slash' SLASH_URI = "http://purl.org/rss/1.0/modules/slash/" RDF.install_ns(SLASH_PREFIX, SLASH_URI) module SlashModel extend BaseModel ELEMENT_INFOS = \ [ ["section"], ["department"], ["comments", :positive_integer], ["hit_parade",...
Ruby
module RSS module Utils module_function # Convert a name_with_underscores to CamelCase. def to_class_name(name) name.split(/[_\-]/).collect do |part| "#{part[0, 1].upcase}#{part[1..-1]}" end.join("") end def get_file_and_line_from_caller(i=0) file, line, = caller[i]...
Ruby
require 'xmlscan/scanner' require 'stringio' module RSS class XMLScanParser < BaseParser class << self def listener XMLScanListener end end private def _parse begin if @rss.is_a?(String) input = StringIO.new(@rss) else input =...
Ruby
require "rexml/document" require "rexml/streamlistener" /\A(\d+)\.(\d+)(?:\.\d+)+\z/ =~ REXML::Version if ([$1.to_i, $2.to_i] <=> [2, 5]) < 0 raise LoadError, "needs REXML 2.5 or later (#{REXML::Version})" end module RSS class REXMLParser < BaseParser class << self def listener REXMLListener...
Ruby
require "forwardable" require "open-uri" require "rss/rss" require "rss/xml" module RSS class NotWellFormedError < Error attr_reader :line, :element # Create a new NotWellFormedError for an error at +line+ # in +element+. If a block is given the return value of # the block ends up in the error me...
Ruby
require "rss/utils" module RSS module XMLStyleSheetMixin attr_accessor :xml_stylesheets def initialize(*args) super @xml_stylesheets = [] end private def xml_stylesheet_pi xsss = @xml_stylesheets.collect do |xss| pi = xss.to_s pi = nil if /\A\s*\z/ =~ pi ...
Ruby
require 'rss/2.0' module RSS ITUNES_PREFIX = 'itunes' ITUNES_URI = 'http://www.itunes.com/dtds/podcast-1.0.dtd' Rss.install_ns(ITUNES_PREFIX, ITUNES_URI) module ITunesModelUtils include Utils def def_class_accessor(klass, name, type, *args) normalized_name = name.gsub(/-/, "_") full_na...
Ruby
require "rss/utils" module RSS class Converter include Utils def initialize(to_enc, from_enc=nil) normalized_to_enc = to_enc.downcase.gsub(/-/, '_') from_enc ||= 'utf-8' normalized_from_enc = from_enc.downcase.gsub(/-/, '_') if normalized_to_enc == normalized_from_enc d...
Ruby