code
stringlengths
1
1.73M
language
stringclasses
1 value
# URI is a module providing classes to handle Uniform Resource Identifiers # (RFC2396[http://tools.ietf.org/html/rfc2396]) # # == Features # # * Uniform handling of handling URIs # * Flexibility to introduce custom URI schemes # * Flexibility to have an alternate URI::Parser (or just different patterns # and regexp's...
Ruby
# = PStore -- Transactional File Storage for Ruby Objects # # pstore.rb - # originally by matz # documentation by Kev Jackson and James Edward Gray II # improved by Hongli Lai # # See PStore for documentation. require "fileutils" require "digest/md5" require "thread" # # PStore implements a file based persiste...
Ruby
# # irb.rb - irb main module # $Release Version: 0.9.6 $ # $Revision: 31641 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" require "irb/init" require "irb/context" require "irb/extend-command" #require "irb/workspace" require "irb/ruby-lex" require "irb/input-method" req...
Ruby
# # GetoptLong for Ruby # # Copyright (C) 1998, 1999, 2000 Motoyuki Kasahara. # # You may redistribute and/or modify this library under the same license # terms as Ruby. # # See GetoptLong for documentation. # # Additional documents and the latest version of `getoptlong.rb' can be # found at http://www.sra.co.jp/peopl...
Ruby
require 'test/unit/assertions' module Test module Unit # remove silly TestCase class remove_const(:TestCase) if defined?(self::TestCase) class TestCase < MiniTest::Unit::TestCase include Assertions def on_parallel_worker? false end def run runner @options = runn...
Ruby
require 'test/unit' module Test module Unit class Worker < Runner class << self undef autorun end alias orig_run_suite _run_suite undef _run_suite undef _run_suites undef run def increment_io(orig) *rest, io = 32.times.inject([orig.dup]){|ios, | ios << ...
Ruby
require 'minitest/unit' require 'pp' module Test module Unit module Assertions include MiniTest::Assertions def mu_pp(obj) #:nodoc: obj.pretty_inspect.chomp end MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc: UNASSIGNED = ...
Ruby
# test/unit compatibility layer using minitest. require 'minitest/unit' require 'test/unit/assertions' require 'test/unit/testcase' require 'optparse' module Test module Unit TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest' module RunCount @@run_count = 0 def self.have...
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. # # # An OpenStruct is a data structure, similar to a Hash, that allows the # definition of arbitra...
Ruby
# # = prime.rb # # Prime numbers and factorization library. # # Copyright:: # Copyright (c) 1998-2008 Keiju ISHITSUKA(SHL Japan Inc.) # Copyright (c) 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp> # # Documentation:: # Yuki Sonoda # require "singleton" require "forwardable" class Integer # Re-composes a prime fact...
Ruby
# # irb/input-method.rb - input methods used irb # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require 'irb/src_encoding' require 'irb/magic-file' module IRB # # InputMethod # StdioInputMethod # FileInputMethod # (ReadlineInputMethod) # ...
Ruby
# # irb/ws-for-case-2.rb - # $Release Version: 0.9.6$ # $Revision: 29726 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # while true IRB::BINDING_QUEUE.push _ = binding end
Ruby
# # irb/workspace-binding.rb - # $Release Version: 0.9.6$ # $Revision: 32252 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB class WorkSpace # create new workspace. set self to main if specified, otherwise # inherit main from TOPLEVEL_BINDING. def initialize(*main) if ...
Ruby
# # irb/lc/error.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" module IRB # exceptions extend Exception2MessageMapper def_exception :UnrecognizedSwitch, "Unrecognized switch: %s" def_exception :NotImplementedError, "Need...
Ruby
# -*- coding: utf-8 -*- # irb/lc/ja/error.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" module IRB # exceptions extend Exception2MessageMapper def_exception :UnrecognizedSwitch, 'スイッチ(%s)が分りません' def_exception :NotImplemen...
Ruby
module IRB class Locale @@legacy_encoding_alias_map = { 'ujis' => Encoding::EUC_JP, 'euc' => Encoding::EUC_JP }.freeze end end
Ruby
# # irb/completor.rb - # $Release Version: 0.9$ # $Revision: 34384 $ # by Keiju ISHITSUKA(keiju@ishitsuka.com) # From Original Idea of shugo@ruby-lang.org # require "readline" module IRB module InputCompletor @RCS_ID='-$Id: completion.rb 34384 2012-01-27 20:53:37Z nobu $-' ReservedWords =...
Ruby
# # xmp.rb - irb version of gotoken xmp # $Release Version: 0.9$ # $Revision: 26986 $ # by Keiju ISHITSUKA(Nippon Rational Inc.) # # -- # # # require "irb" require "irb/frame" class XMP @RCS_ID='-$Id: xmp.rb 26986 2010-03-20 03:30:59Z nobu $-' def initialize(bind = nil) IRB.init_config(nil) #I...
Ruby
# # irb/extend-command.rb - irb extend command # $Release Version: 0.9.6$ # $Revision: 25998 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB # # IRB extended command # module ExtendCommandBundle EXCB = ExtendCommandBundle NO_OVERRIDE = 0 OVERRIDE_PRIVATE_ONLY = 0x01 ...
Ruby
# # notifier.rb - output methods used by irb # $Release Version: 0.9.6$ # $Revision: 26986 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" require "irb/output-method" module IRB module Notifier extend Exception2MessageMapper def_exception :ErrUndefinedNotifier, "un...
Ruby
# # irb/ruby-lex.rb - ruby lexcal analyzer # $Release Version: 0.9.6$ # $Revision: 32272 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" require "irb/slex" require "irb/ruby-token" class RubyLex @RCS_ID='-$Id: ruby-lex.rb 32272 2011-06-28 12:52:21Z keiju $-' extend Exception2...
Ruby
# # irb/help.rb - print usage module # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # # # require 'irb/magic-file' module IRB def IRB.print_usage lc = IRB.conf[:LC_MESSAGES] path = lc.find("irb/help-message") space_line = false IRB::MagicF...
Ruby
# # irb/context.rb - irb context # $Release Version: 0.9.6$ # $Revision: 27117 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "irb/workspace" require "irb/inspector" module IRB class Context # # Arguments: # input_method: nil -- stdin or readline # String -- File...
Ruby
# DO NOT WRITE ANY MAGIC COMMENT HERE. def default_src_encoding return __ENCODING__ end
Ruby
# # irb/inspector.rb - inspect methods # $Release Version: 0.9.6$ # $Revision: 1.19 $ # $Date: 2002/06/11 07:51:31 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB def IRB::Inspector(inspect, init = nil) Inspector.new(inspect, init) end class Inspector def initialize(in...
Ruby
# # irb/locale.rb - internationalization module # $Release Version: 0.9.6$ # $Revision: 31573 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB class Locale @RCS_ID='-$Id: locale.rb 31573 2011-05-15 11:55:52Z nobu $-' LOCALE_NAME_RE = %r[ (?<language>[[:alpha:]]{2,3}) ...
Ruby
module IRB class << (MagicFile = Object.new) # see parser_magic_comment in parse.y ENCODING_SPEC_RE = %r"coding\s*[=:]\s*([[:alnum:]\-_]+)" def open(path) io = File.open(path, 'rb') line = io.gets line = io.gets if line[0,2] == "#!" encoding = detect_encoding(line) encoding ...
Ruby
# # irb/init.rb - irb initialize module # $Release Version: 0.9.6$ # $Revision: 31573 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB # initialize config def IRB.setup(ap_path) IRB.init_config(ap_path) IRB.init_error IRB.parse_opts IRB.run_config IRB.load_modules...
Ruby
# multi.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "irb/cmd/nop.rb" require "irb/ext/multi-irb" module IRB module ExtendCommand class IrbCommand<Nop def execute(*obj) IRB.irb(nil, *obj) end end class Jobs<N...
Ruby
# # change-ws.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "irb/cmd/nop.rb" require "irb/ext/change-ws.rb" module IRB module ExtendCommand class CurrentWorkingWorkspace<Nop def execute(*obj) irb_context.main end ...
Ruby
# # fork.rb - # $Release Version: 0.9.6 $ # $Revision: 27967 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # @RCS_ID='-$Id: fork.rb 27967 2010-05-23 08:48:44Z nobu $-' module IRB module ExtendCommand class Fork<Nop def execute(&block) pid = send ExtendCommand.irb_original_method_name...
Ruby
# # help.rb - helper using ri # $Release Version: 0.9.6$ # $Revision: 32286 $ # # -- # # # require 'rdoc/ri/driver' require "irb/cmd/nop.rb" module IRB module ExtendCommand class Help<Nop begin Ri = RDoc::RI::Driver.new rescue SystemExit else def execute(*names) ...
Ruby
# # change-ws.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "irb/cmd/nop.rb" require "irb/ext/workspaces.rb" module IRB module ExtendCommand class Workspaces<Nop def execute(*obj) irb_context.workspaces.collect{|ws| ws.main}...
Ruby
# # nop.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB module ExtendCommand class Nop @RCS_ID='-$Id: nop.rb 25189 2009-10-02 12:04:37Z akr $-' def self.execute(conf, *opts) command = new(conf) command.execute(*opts)...
Ruby
# # load.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "irb/cmd/nop.rb" require "irb/ext/loader" module IRB module ExtendCommand class Load<Nop include IrbLoader def execute(file_name, priv = nil) # return ruby_load(fi...
Ruby
# # frame.rb - # $Release Version: 0.9$ # $Revision: 25189 $ # by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd) # # -- # # # require "e2mmap" module IRB class Frame extend Exception2MessageMapper def_exception :FrameOverflow, "frame overflow" def_exception :FrameUnderflow, "frame underflow...
Ruby
# # use-loader.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "irb/cmd/load" require "irb/ext/loader" class Object alias __original__load__IRB_use_loader__ load alias __original__require__IRB_use_loader__ require end module IRB mod...
Ruby
# # irb/ext/cb.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB class Context def home_workspace if defined? @home_workspace @home_workspace else @home_workspace = @workspace end end def change_workspac...
Ruby
# # loader.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB class LoadAbort < Exception;end module IrbLoader @RCS_ID='-$Id: loader.rb 25189 2009-10-02 12:04:37Z akr $-' alias ruby_load load alias ruby_require require ...
Ruby
# save-history.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "readline" module IRB module HistorySavingAbility @RCS_ID='-$Id: save-history.rb 25189 2009-10-02 12:04:37Z akr $-' end class Context def init_save_history ...
Ruby
# # irb/lib/tracer.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "tracer" module IRB # initialize tracing function def IRB.initialize_tracer Tracer.verbose = false Tracer.add_filter { |event, file, line, id, binding, *r...
Ruby
# # irb/multi-irb.rb - multiple irb module # $Release Version: 0.9.6$ # $Revision: 29726 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # IRB.fail CantShiftToMultiIrbMode unless defined?(Thread) require "thread" module IRB # job management class class JobManager @RCS_ID='-$Id: multi-irb.rb 2...
Ruby
# # push-ws.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB class Context def irb_level workspace_stack.size end def workspaces if defined? @workspaces @workspaces else @workspaces = [] end e...
Ruby
# # history.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module IRB class Context NOPRINTING_IVARS.push "@eval_history_values" alias _set_last_value set_last_value def set_last_value(value) _set_last_value(value) # ...
Ruby
# # math-mode.rb - # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "mathn" module IRB class Context attr_reader :math_mode alias math? math_mode def math_mode=(opt) if @math_mode == true && opt == false IRB.fail CantReturnT...
Ruby
# # irb/ruby-token.rb - ruby tokens # $Release Version: 0.9.6$ # $Revision: 28158 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # module RubyToken EXPR_BEG = :EXPR_BEG EXPR_MID = :EXPR_MID EXPR_END = :EXPR_END EXPR_ARG = :EXPR_ARG EXPR_FNAME = :EXPR_FNAME EXPR_DOT = :EXPR_DOT EXPR_CLAS...
Ruby
# # irb/slex.rb - simple lex analyzer # $Release Version: 0.9.6$ # $Revision: 28619 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" require "irb/notifier" module IRB class SLex @RCS_ID='-$Id: slex.rb 28619 2010-07-11 16:59:10Z marcandre $-' extend Exception2MessageMappe...
Ruby
# # output-method.rb - output methods used by irb # $Release Version: 0.9.6$ # $Revision: 26986 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # require "e2mmap" module IRB # OutputMethod # StdioOutputMethod class OutputMethod @RCS_ID='-$Id: output-method.rb 26986 2010-03-20 03:30:59Z ...
Ruby
# # irb/version.rb - irb version definition file # $Release Version: 0.9.6$ # $Revision: 25189 $ # by Keiju ISHITSUKA(keiju@ishitsuka.com) # # -- # # # module IRB @RELEASE_VERSION = "0.9.6" @LAST_UPDATE_DATE = "09/06/30" end
Ruby
# logger.rb - simple logging utility # Copyright (C) 2000-2003, 2005, 2008, 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # # Documentation:: NAKAMURA, Hiroshi and Gavin Sinclair # License:: # You can redistribute it and/or modify it under the same terms of Ruby's # license; either the dual license version in 2003,...
Ruby
# This file allows for the running of rubygems with a nice # command line look-and-feel: ruby -rubygems foo.rb #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems'
Ruby
# Timeout long-running blocks # # == Synopsis # # require 'timeout' # status = Timeout::timeout(5) { # # Something that should be interrupted if it takes more than 5 seconds... # } # # == Description # # Timeout provides a way to auto-terminate a potentially long-running # operation if it hasn't finished in a...
Ruby
# -*- indent-tabs-mode: t -*- # module to create Makefile for extension modules # invoke like: ruby -r mkmf extconf.rb require 'rbconfig' require 'fileutils' require 'shellwords' CONFIG = RbConfig::MAKEFILE_CONFIG ORIG_LIBPATH = ENV['LIB'] C_EXT = %w[c m] CXX_EXT = %w[cc mm cxx cpp] if File::FNM_SYSCASE.zero? CXX_...
Ruby
## # = Tracer # # Tracer outputs a source level execution trace of a Ruby program. It does # this by registering an event handler with <code>Kernel#set_trace_func</code> # for processing incoming events. It also provides methods for filtering # unwanted trace output (see Tracer.add_filter, Tracer.on, and Tracer.off). ...
Ruby
require "delegate" require 'thread' # Weak Reference class that allows a referenced object to be # garbage-collected. A WeakRef may be used exactly like the object it # references. # # Usage: # # foo = Object.new # foo = Object.new # p foo.to_s # original's class # foo = WeakRef.new(foo) # ...
Ruby
# # cgi/session.rb - session support for cgi scripts # # Copyright (C) 2001 Yukihiro "Matz" Matsumoto # Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Information-technology Promotion Agency, Japan # # Author: Yukihiro "Matz" Matsumoto # # Documentation: William Webber (willia...
Ruby
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_def(element) nOE_element_d...
Ruby
# # cgi/session/pstore.rb - persistent storage of marshalled session data # # Documentation: William Webber (william@williamwebber.com) # # == Overview # # This file provides the CGI::Session::PStore class, which builds # persistent of session data on top of the pstore library. See # cgi/session.rb for more details on...
Ruby
#-- # Methods for generating HTML, parsing CGI-related parameters, and # generating HTTP responses. #++ class CGI $CGI_ENV = ENV # for FCGI support # String for carriage return CR = "\015" # String for linefeed LF = "\012" # Standard internet newline sequence EOL = CR + LF REVISION = '$Id: cor...
Ruby
class CGI @@accept_charset="UTF-8" unless defined?(@@accept_charset) # URL-encode a string. # url_encoded_string = CGI::escape("'Stop!' said Fred") # # => "%27Stop%21%27+said+Fred" def CGI::escape(string) string.gsub(/([^ a-zA-Z0-9_.-]+)/) do '%' + $1.unpack('H2' * $1.bytesize).join('%').upca...
Ruby
class CGI @@accept_charset="UTF-8" unless defined?(@@accept_charset) # Class representing an HTTP cookie. # # In addition to its specific fields and methods, a Cookie instance # is a delegator to the array of its values. # # See RFC 2965. # # == Examples of use # cookie1 = CGI::Cookie::new("name",...
Ruby
# # tmpdir - retrieve temporary directory path # # $Id: tmpdir.rb 31635 2011-05-18 21:19:18Z drbrain $ # require 'fileutils' begin require 'etc.so' rescue LoadError end class Dir @@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '/tmp' ## # Returns the operating system's temporary file path. def ...
Ruby
# # YAML::Store # require 'yaml' require 'pstore' # YAML::Store provides the same functionality as PStore, except it uses YAML # to dump objects instead of Marshal. # # == Example # # require 'yaml/store' # # Person = Struct.new :first_name, :last_name # # people = [Person.new("Bob", "Smith"), Person.new("Mary",...
Ruby
require 'yaml' require 'dbm' module YAML # YAML + DBM = YDBM # # YAML::DBM provides the same interface as ::DBM. # # However, while DBM only allows strings for both keys and values, # this library allows one to use most Ruby objects for values # by first converting them to YAML. Keys must be strings. # # Conversion t...
Ruby
require 'uri' require 'stringio' require 'time' module Kernel private alias open_uri_original_open open # :nodoc: class << self alias open_uri_original_open open # :nodoc: end # Allows the opening of various resources including URIs. # # If the first argument responds to the 'open' method, 'open' is...
Ruby
## # = WEB server toolkit. # # WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, # a proxy server, and a virtual-host server. WEBrick features complete # logging of both server operations and HTTP access. WEBrick supports both # basic and digest authentication in addition to algorithms not ...
Ruby
#!/usr/bin/env ruby #-- # 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 $ # $Id: ab...
Ruby
# # thwait.rb - thread synchronization class # $Release Version: 0.9 $ # $Revision: 1.3 $ # by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd.) require "thread.rb" require "e2mmap.rb" # # This class watches for termination of multiple threads. Basic functionality # (wait until specified threads ...
Ruby
require 'optparse' require 'rdoc/ri/paths' ## # RDoc::Options handles the parsing and storage of options class RDoc::Options ## # The deprecated options. DEPRECATED = { '--accessor' => 'support discontinued', '--diagram' => 'support discontinued', '--help-output' => 'support disconti...
Ruby
require 'erb' ## # A subclass of ERB that writes directly to an IO. Credit to Aaron Patterson # and Masatoshi SEKI. # # To use: # # erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil # # open 'hello.txt', 'w' do |io| # erbio.result binding # end # # Note that binding must enclose the io you wish to ou...
Ruby
require 'rdoc' ## # RDoc::Markup parses plain text documents and attempts to decompose them into # their constituent parts. Some of these parts are high-level: paragraphs, # chunks of verbatim text, list entries and the like. Other parts happen at # the character level: a piece of bold text, a word in code font. Th...
Ruby
## # RDoc::CrossReference is a reusable way to create cross references for names. class RDoc::CrossReference ## # Regular expression to match class references # # 1. There can be a '\\' in front of text to suppress the cross-reference # 2. There can be a '::' in front of class names to reference from the ...
Ruby
require 'rdoc/code_object' ## # Abstract class representing either a method or an attribute. class RDoc::MethodAttr < RDoc::CodeObject include Comparable ## # Name of this method/attribute. attr_accessor :name ## # public, protected, private attr_accessor :visibility ## # Is this a singleton m...
Ruby
require 'rdoc/any_method' ## # MetaMethod represents a meta-programmed method class RDoc::MetaMethod < RDoc::AnyMethod end
Ruby
require 'rdoc/class_module' ## # A normal class, neither singleton nor anonymous class RDoc::NormalClass < RDoc::ClassModule ## # Appends the superclass, if any, to the included modules. def ancestors superclass ? super + [superclass] : super end ## # The definition of this class, <tt>class MyClass...
Ruby
## # Stats printer that prints everything documented, including the documented # status class RDoc::Stats::Verbose < RDoc::Stats::Normal ## # Returns a marker for RDoc::CodeObject +co+ being undocumented def nodoc co " (undocumented)" unless co.documented? end def print_alias as # :nodoc: puts " ...
Ruby
## # Stats printer that prints nothing class RDoc::Stats::Quiet ## # Creates a new Quiet that will print nothing def initialize num_files @num_files = num_files end ## # Prints a message at the beginning of parsing def begin_adding(*) end ## # Prints when an alias is added def print_alias...
Ruby
## # Stats printer that prints just the files being documented with a progress # bar class RDoc::Stats::Normal < RDoc::Stats::Quiet def begin_adding # :nodoc: puts "Parsing sources..." if $stdout.tty? end ## # Prints a file with a progress bar def print_file files_so_far, filename return unless $s...
Ruby
require 'rdoc/method_attr' require 'rdoc/token_stream' ## # AnyMethod is the base class for objects representing methods class RDoc::AnyMethod < RDoc::MethodAttr MARSHAL_VERSION = 1 # :nodoc: ## # Don't rename \#initialize to \::new attr_accessor :dont_rename_initialize ## # The C function that implem...
Ruby
# This file is loaded by generators. It allows RDoc's CodeObject tree to # avoid loading generator code to increase startup time (for ri). require 'rdoc/text' require 'rdoc/code_objects' require 'rdoc/generator' require 'rdoc/markup/to_html_crossref' require 'rdoc/ruby_token' ## # Handle common RDoc::Markup tasks fo...
Ruby
require 'rdoc/generator' require 'rdoc/ri' ## # Generates ri data files class RDoc::Generator::RI RDoc::RDoc.add_generator self ## # Description of this generator DESCRIPTION = 'creates ri data files' ## # Set up a new ri generator def initialize options #:not-new: @options = options @o...
Ruby
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*- require 'pathname' require 'fileutils' require 'rdoc/erbio' require 'rdoc/generator/markup' ## # Darkfish RDoc HTML Generator # # $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $ # # == Author/s # * Michael Granger (ged@FaerieMUD.org) # # == Contributors # ...
Ruby
require 'rdoc' ## # Namespace for the ri command line tool's implementation. # # See <tt>ri --help</tt> for details. module RDoc::RI ## # Base RI error class class Error < RDoc::Error; end end require 'rdoc/ri/store'
Ruby
require 'rdoc/class_module' ## # An anonymous class like: # # c = Class.new do end # # AnonClass is currently not used. class RDoc::AnonClass < RDoc::ClassModule end
Ruby
require 'rdoc/class_module' ## # A normal module, like NormalClass class RDoc::NormalModule < RDoc::ClassModule def inspect # :nodoc: "#<%s:0x%x module %s includes: %p attributes: %p methods: %p aliases: %p>" % [ self.class, object_id, full_name, @includes, @attributes, @method_list, @aliases ]...
Ruby
require 'rdoc/code_object' ## # A constant class RDoc::Constant < RDoc::CodeObject ## # If this constant is an alias for a module or class, # this is the RDoc::ClassModule it is an alias for. # +nil+ otherwise. attr_accessor :is_alias_for ## # The constant's name attr_accessor :name ## # The ...
Ruby
require 'rdoc' ## # RDoc uses generators to turn parsed source code in the form of an # RDoc::CodeObject tree into some form of output. RDoc comes with the HTML # generator RDoc::Generator::Darkfish and an ri data generator # RDoc::Generator::RI. # # = Registering a Generator # # Generators are registered by calling ...
Ruby
require 'rdoc' ## # RDoc statistics collector which prints a summary and report of a project's # documentation totals. class RDoc::Stats ## # Output level for the coverage report attr_reader :coverage_level ## # Count of files parsed during parsing attr_reader :files_so_far ## # Total number of f...
Ruby
require 'rdoc' require 'rdoc/code_objects' require 'rdoc/markup/pre_process' require 'rdoc/stats' ## # A parser is a class that subclasses RDoc::Parser and implements # # #initialize top_level, file_name, body, options, stats # # and # # #scan # # The initialize method takes a file name to be used, the body of the...
Ruby
require 'rdoc/context' ## # ClassModule is the base class for objects representing either a class or a # module. class RDoc::ClassModule < RDoc::Context ## # 1:: # RDoc 3.7 # * Added visibility, singleton and file to attributes # * Added file to constants # * Added file to includes # * Added ...
Ruby
require 'rdoc/any_method' ## # GhostMethod represents a method referenced only by a comment class RDoc::GhostMethod < RDoc::AnyMethod end
Ruby
## # Manages changes of attributes in a block of text class RDoc::Markup::AttributeManager ## # The NUL character NULL = "\000".freeze #-- # We work by substituting non-printing characters in to the text. For now # I'm assuming that I can substitute a character in the range 0..8 for a 7 # bit characte...
Ruby
## # An item within a List that contains paragraphs, headings, etc. class RDoc::Markup::ListItem ## # The label for the ListItem attr_accessor :label ## # Parts of the ListItem attr_reader :parts ## # Creates a new ListItem with an optional +label+ containing +parts+ def initialize label = nil,...
Ruby
require 'minitest/unit' require 'rdoc/markup/formatter' ## # Test case for creating new RDoc::Markup formatters. See # test/test_rdoc_markup_to_*.rb for examples. # # This test case adds a variety of tests to your subclass when # #add_visitor_tests is called. Most tests set up a scenario then call a # method you wil...
Ruby
require 'rdoc/markup/to_html' require 'rdoc/cross_reference' ## # Subclass of the RDoc::Markup::ToHtml class that supports looking up method # names, classes, etc to create links. RDoc::CrossReference is used to # generate those links based on the current context. class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::T...
Ruby
## # A Paragraph of text class RDoc::Markup::Paragraph < RDoc::Markup::Raw ## # Calls #accept_paragraph on +visitor+ def accept visitor visitor.accept_paragraph self end end
Ruby
require 'rdoc' class RDoc::Markup ## # We manage a set of attributes. Each attribute has a symbol name and a bit # value. class Attribute ## # Special attribute type. See RDoc::Markup#add_special SPECIAL = 1 @@name_to_bitmap = { :_SPECIAL_ => SPECIAL } @@next_bitmap = 2 ## # R...
Ruby
require 'rdoc/markup/formatter_test_case' ## # Test case for creating new plain-text RDoc::Markup formatters. See also # RDoc::Markup::FormatterTestCase # # See test_rdoc_markup_to_rdoc.rb for a complete example. # # Example: # # class TestRDocMarkupToNewTextFormat < RDoc::Markup::TextFormatterTestCase # # add_vi...
Ruby
require 'strscan' require 'rdoc/text' ## # A recursive-descent parser for RDoc markup. # # The parser tokenizes an input string then parses the tokens into a Document. # Documents can be converted into output formats by writing a visitor like # RDoc::Markup::ToHTML. # # The parser only handles the block-level construc...
Ruby
## # A section of text that is added to the output document as-is class RDoc::Markup::Raw ## # The component parts of the list attr_reader :parts ## # Creates a new Raw containing +parts+ def initialize *parts @parts = [] @parts.push(*parts) end ## # Appends +text+ def << text @pa...
Ruby