Archive for August 6th, 2006

  • Building an “include” graph

    August 6, 2006

    How easy would it be to build include graphs in ruby? Here's my first attempt: PLAIN TEXT RUBY: $list_of_files = Hash.new $list_of_files.each {|node| node = Array.new } def store_includes(pathname) lines = IO.readlines(pathname) lines.each {|line| if line.include? "#include" include_file = line[line.index("#include")+"#include".size,line.size] fidx = 0 sidx = 0   if include_file.include?("\"") fidx = include_file.index("\"") + 1 sidx [...]

  • File extensions in ruby

    August 6, 2006

    Is there a more efficient way to extract the file extensions in ruby? I currently do the following. PLAIN TEXT RUBY: ext = File.basename(filepath).reverse.split('.')[0].reverse

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org