class Object
Constants
- AB_PATH
- CHISE_DIR
Copyright © 2003-2006 Kouichirou Eto, All rights reserved. This is free software with ABSOLUTELY NO WARRANTY. You can redistribute it and/or modify it under the terms of the GNU GPL 2.
- COPYRIGHT_BANNER
Public Instance Methods
Sendmail(*args)
click to toggle source
# File vendor/qwik/lib/qwik/util-sendmail.rb, line 172 def Sendmail(*args) Sendmail.send_mail(*args) end
autoreload(*a)
click to toggle source
# File vendor/qwik/lib/qwik/autoreload.rb, line 96 def autoreload(*a) AutoReload.start(*a) end
check_monitor_main()
click to toggle source
Copyright © 2003-2006 Kouichirou Eto, All rights reserved. This is free software with ABSOLUTELY NO WARRANTY. You can redistribute it and/or modify it under the terms of the GNU GPL 2.
# File vendor/qwik/lib/qwik/check-monitor.rb, line 5 def check_monitor_main require 'monitor.rb' buf = [] buf.extend(MonitorMixin) empty_cond = buf.new_cond # consumer Thread.start { loop { buf.synchronize { empty_cond.wait_while { buf.empty? } print buf.shift } } } # producer while line = ARGF.gets buf.synchronize { buf.push(line) empty_cond.signal } end end
check_observer_main()
click to toggle source
# File vendor/qwik/lib/qwik/check-observer.rb, line 58 def check_observer_main ticker = Ticker.new('MSFT') WarnLow.new(ticker, 80) WarnHigh.new(ticker, 120) ticker.run end
die(msg)
click to toggle source
# File vendor/qwik/lib/qwik/dev-calctime.rb, line 8 def die(msg) puts msg exit 1 end
dummy_replace_line(line)
click to toggle source
# File vendor/qwik/lib/qwik/dev-replace.rb, line 10 def dummy_replace_line(line) # dummy return line end
generate_large_table(table_line_num)
click to toggle source
# File vendor/qwik/lib/qwik/tokenizer.rb, line 301 def generate_large_table(table_line_num) str = '' table_line_num.times {|n| str << "|#{n}|1|2|3|4|5|6|7|8|9|0\n" } return str end
main()
click to toggle source
# File vendor/qwik/lib/qwik/dev-bench.rb, line 163 def main url = "http://127.0.0.1:9190/" requests = 1000 concurrency = 100 cmd = "#{AB_PATH} -n #{requests} -c #{concurrency} #{url}" puts cmd system cmd end
ok(e, str)
click to toggle source
# File vendor/qwik/lib/qwik/parser-inline.rb, line 249 def ok(e, str) tree = Qwik::InlineParser.parse(str) end
qp(*args)
click to toggle source
# File vendor/qwik/lib/qwik/qp.rb, line 32 def qp(*args) $stdout.print QP.qp(caller(1), *args)+"\n" end
replace_content_by_line(content, dryrun) { || ... }
click to toggle source
# File vendor/qwik/lib/qwik/dev-replace.rb, line 20 def replace_content_by_line(content, dryrun) replace = false newcontent = '' content.each {|line| newline = replace_line(line) if newline != line yield puts "-#{line}" puts "+#{newline}" replace = true end newline = line if dryrun # for debug newcontent << newline } return replace, newcontent, dryrun end
replace_line(line)
click to toggle source
# File vendor/qwik/lib/qwik/dev-replace.rb, line 14 def replace_line(line) return line.gsub(/\$LOAD_PATH \<\< \'\.\.\'/) { "$LOAD_PATH.unshift '..'" } end
start_server()
click to toggle source
# File vendor/qwik/lib/qwik/check-webdav.rb, line 30 def start_server $running = true AutoReload.start(1, true) # auto reload every sec. log = WEBrick::Log.new log.level = WEBrick::Log::DEBUG if $DEBUG server = WEBrick::HTTPServer.new({:Port => 10080, :Logger => log}) server.mount("/", MyWebDAVHandler, Dir.pwd) trap(:INT) { server.shutdown } server.start end
test_date()
click to toggle source
# File vendor/qwik/lib/qwik/util-time.rb, line 90 def test_date # test_date_parse time = Time.date_parse('1970-01-01') assert_equal(-32400, time.to_i) # test_date_abbr now = Time.local(1970, 1, 1) t2 = Time.local(1970, 1, 2) abbr = Time.date_abbr(now, t2) assert_equal '01-02', abbr t2 = Time.local(1971, 1, 1) abbr = Time.date_abbr(now, t2) assert_equal '1971-01-01', abbr # test_date_emphasis now = Time.local(1970, 2, 1) past = Time.local(1970, 1, 30) span = Time.date_emphasis(now, past, 't') assert_equal [:span, {:class=>'past'}, 't'], span tomorrow = Time.local(1970, 2, 2) span = Time.date_emphasis(now, tomorrow, 't') assert_equal [:strong, 't'], span nextweek = Time.local(1970, 2, 9) span = Time.date_emphasis(now, nextweek, 't') assert_equal [:em, 't'], span nextmonth = Time.local(1970, 3, 3) span = Time.date_emphasis(now, nextmonth, 't') assert_equal [:span, {:class=>'future'}, 't'], span end
tp(*args)
click to toggle source
# File vendor/qwik/lib/qwik/qp.rb, line 36 def tp(*args) print QP.tp(caller(1), *args)+"\n" end