Top Level Namespace

Includes:
Config, GD, UtilityFunctions

Defined Under Namespace

Modules: Bar0, Baz, BinaryReader, BottomScope, Breakpoint, ByteOrder, ClassMethods, CloseCall, Constant, CrossCase, DRb, DeepNesting1, DeepNesting2, Dispatch, DoNotErace, DynamicMixin, Elementary, Enumerable, EnumerableWithArgs, First, HTML, IRB, Import_Module, Inheritance, Interface, InterfaceContracts, Kernel, Lisp, Miscellaneous, Mod1, Mod2, MultiThreadNesting, Multiton, MyInterface, MySubInterface, NilComparable, NonExistance, NotCopyable, OpenStructable, Predicate, Private_NewMethod, Private_Proteced_Inheritance, Private_Protected, RubyInfo, S1, S2, ScopeCreate, ScopesInThreads, Second, SingletonMethod, SingletonMethod2, StarArg, Super, Super2, Super3, Sys, System, Term, TestLogic, Text, Triple, Uninheritable, UtilityFunctions, VariousTiming Classes: A, AClass, Array, Association, B, BBCode, Bar, Binding, BlankSlate, C, Class, CommandRunner, Contract, Coroutine, CountingSemaphore, Daemon, Expect, FalseClass, FileList, FloatString, Foo, Foo0, Foo1, Foo2, Functor, GeneralTest, HArray, Hash, Heap, ImplementationError, InfTest, Infinity, Integer, Interval, InvalidNackError, Logger, LrgNumericTest, Method, Module, MyClass, NackClass, NilClass, Object, OrderedHash, OrdinalTest, PQueue, Parser, Person, PriorityQueue, Quaternion, Range, Ref, SimpleStringIO, StaticHash, String, Struct, SuperStruct, Symbol, T, TC_CloseCall, TC_Constructor, TC_Detach, TC_Interface, TC_Predicate, TC_TopLevel, Test_Timer, TextTagIterator, Thread, Time, Timer, TopLevelClass, TracePoint, Tuple, Type, Version

Constant Summary collapse

INFINITY =

constant (for aleph=0)

Infinity.instance
Semaphore =
CountingSemaphore
K =

1.rb one-liners helper lib.

Kernel
O =
Object
CodePoint =

This is the same as a Binding. Not really needed, but I like consistency :)

Binding
TOPLEVEL =

assign constant

TopLevelClass.instance
F =
false
E =
1
Usage =
<<__END
  Usage: ruby install.rb [options]
  
      option      argument  action
      ------      --------  ------
      --destdir   dir       Destination dir
      -d                    (default is #{destdir})
      
      --mandir    dir       Manual dir
                            (default is #{destmandir})
      
      --man                 Install manuals

      --help                Print this help
      -h
      
      --noharm              Do not install, just print commands
      -n
__END
ScopeS1 =
ScopeInState.new(S1)
ScopeS2 =
ScopeInState.new(S2)
TestInterface =
interface{
	required_methods :foo, :bar
}
TestSubInterface =
interface{
	extend TestInterface
	required_methods :baz
}

Constants included from UtilityFunctions

UtilityFunctions::ANTIMANIFEST, UtilityFunctions::AnsiAttributes, UtilityFunctions::ErasePreviousLine

Class Method Summary collapse

Instance Method Summary collapse

Methods included from UtilityFunctions

abort, ansiCode, debugMsg, divider, editInPlace, ensure_version, errorMessage, extractNextVersionFromTags, extractProjectName, findProgram, findRdocableFiles, getVettedManifest, header, message, prompt, promptWithDefault, readManifest, replaceMessage, shellCommand, terse_block, testForLibrary, testForRequiredLibrary, try, verboseOff, verbose_block, vetManifest

Class Method Details

.resc(str) ⇒ Object

class Parser::Registry



308
# File 'lib/carat/parser.rb', line 308

def self.resc(str) ; Regexp.escape(str) ; end

Instance Method Details

#assert(m, n = nil) ⇒ Object

See Breakpoint.assert



514
515
516
517
518
# File 'lib/carat-dev/breakpoint.rb', line 514

def assert(&block)
  Binding.of_caller do |context|
    Breakpoint.assert(context, &block)
  end
end

#assert_class_includes(klass, mod) ⇒ Object

Determine if a class includes a module, in O(n) time.

Returns:

  • true if the class includes the module, false otherwise.



65
66
67
68
69
# File 'lib/carat-dev/interface_work/SCRAP/interface.rb', line 65

def assert_class_includes(klass, mod)
  if not klass.includes_module?(mod) then
    raise TypeError, "foo_obj should have the Foo interface"
  end
end

#assert_class_includes_complete(klass, mod) ⇒ Object

Determine if a class includes a module and implements all the module’s abstract methods, in O(n+m) time.

Returns:

  • true if the class includes the module, false otherwise.



86
87
88
89
90
91
92
93
94
# File 'lib/carat-dev/interface_work/SCRAP/interface.rb', line 86

def assert_class_includes_complete(klass, mod)
  assert_class_includes(klass, mod)
  imethods = mod.class_eval("@@__interface_methods__")
  imethods.each do |meth|
    if not klass.method_defined?(meth) then
      raise TypeError, "Class #{klass} should have method #{meth} from module #{mod} defined"
    end
  end
end

#assert_object_includes(obj, mod) ⇒ Object

Determine if an object’s class includes a module, in O(n) time.

Returns:

  • true if the object’s class includes the module, false otherwise.



76
77
78
# File 'lib/carat-dev/interface_work/SCRAP/interface.rb', line 76

def assert_object_includes(obj, mod)
  assert_class_includes(obj.class, mod)
end

#assert_object_includes_complete(obj, mod) ⇒ Object

Determine if an object’s class includes a module and implements all the module’s abstract methods, in O(n+m) time.

Returns:

  • true if the object’s class includes the module, false otherwise.



102
103
104
# File 'lib/carat-dev/interface_work/SCRAP/interface.rb', line 102

def assert_object_includes_complete(obj, mod)
  assert_class_includes_complete(obj.class, mod)
end

#bm(s = "", t = nil) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/carat-dev/import-module/import-module-0.81/test/test-time.rb', line 68

def bm(s = "", t = nil)
  if t
    s += " " + t
  end
  start = Time.now
  v = yield
  [s, Time.now - start]
end

#breakpoint(id = nil, &block) ⇒ Object

See Breakpoint.breakpoint



507
508
509
510
511
# File 'lib/carat-dev/breakpoint.rb', line 507

def breakpoint(id = nil, &block)
  Binding.of_caller do |context|
    Breakpoint.breakpoint(id, context, &block)
  end
end

#interface(&block) ⇒ Object



39
40
41
42
43
44
# File 'lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/lib/interface.rb', line 39

def interface(&block)
    mod = Module.new
    mod.extend Interface
    mod.instance_eval(&block)
    mod
end

#nail(arg) ⇒ Object

private Object method



103
104
105
106
107
108
109
# File 'lib/carat/nack.rb', line 103

def nail( arg )
  if NackClass === arg
    arg.raise_error
  else
    return arg
  end
end

#Quaternion(a = 0, b = 0, c = 0, d = 0) ⇒ Object



193
194
195
196
197
198
199
200
201
202
203
# File 'lib/carat-dev/quaternion/quaternion.rb', line 193

def Quaternion(a=0, b=0,c=0, d=0)
	if a.kind_of?(Quaternion);
		a;
	elsif a.kind_of?(Complex) and b.kind_of?(Complex);
		Quaternion.new(a.real, a.image, b.real, b.image)
	elsif a.kind_of?(Complex);
		Quaternion.new(a.real, a.image)
	else
		Quaternion.new(a,b,c,d);
	end
end