Skip to content

Commit

Permalink
added utils
Browse files Browse the repository at this point in the history
  • Loading branch information
quix committed Aug 29, 2008
1 parent f4ee111 commit 4843fba
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Rakefile
@@ -1,7 +1,7 @@
$LOAD_PATH.unshift "./contrib/quix/lib"

#require 'quix/simple_installer'
#require 'quix/subpackager'
require 'quix/simple_installer'
require 'quix/subpackager'

require 'rake/packagetask'
require 'rake/rdoctask'
Expand Down
33 changes: 33 additions & 0 deletions lib/comptree/quix/builtin/kernel/tap.rb
@@ -0,0 +1,33 @@



######################################################
#
# **** DO NOT EDIT ****
#
# **** THIS IS A GENERATED FILE *****
#
######################################################



unless respond_to? :tap
module Kernel
def tap
yield self
self
end
end
end



######################################################
#
# **** DO NOT EDIT ****
#
# **** THIS IS A GENERATED FILE *****
#
######################################################


68 changes: 68 additions & 0 deletions lib/comptree/quix/diagnostic.rb
@@ -0,0 +1,68 @@



######################################################
#
# **** DO NOT EDIT ****
#
# **** THIS IS A GENERATED FILE *****
#
######################################################



require 'comptree/quix/builtin/kernel/tap'

module CompTree::Quix
module Diagnostic
def show(desc = nil, stream = STDOUT, &block)
if desc
stream.puts(desc)
end
if block
expression = block.call
eval(expression, block.binding).tap { |result|
stream.printf("%-16s => %s\n", expression, result.inspect)
}
end
end

if $DEBUG
def debug
yield
end

def debugging?
true
end

def trace(desc = nil, &block)
if desc
show("#{desc}.".sub(%r!\.\.+\Z!, ""), STDERR, &block)
else
show(nil, STDERR, &block)
end
end
else
# non-$DEBUG
def debug ; end
def debugging? ; end
def trace(*args) ; end
end

extend self
end
end




######################################################
#
# **** DO NOT EDIT ****
#
# **** THIS IS A GENERATED FILE *****
#
######################################################


0 comments on commit 4843fba

Please sign in to comment.