Create  Edit  Diff  Phillro Industries  Index  Search  Changes  History  Source  RSS  Note  wikifarm  Login

phi_const_for_wiki.rb

   1|#! ruby -Ks
   2|#-- phi_const_for_wiki.rb
   3|#-- phi_const_for_wiki.pi
   4|
   5|require "phi"
   6|require "phi_const_categories"
   7|
   8|def phi_const_for_wiki(mod=Phi)
   9|  phi_const_cat = phi_const_categories
  10|  list = mod.constants.sort_by{|n|n.downcase}
  11|  list = list.collect{|name| 
  12|    n = "#{mod}::#{name}";
  13|    c = eval("#{n}.class")
  14|    i = " = " + eval("#{n}.inspect")
  15|    i = "" if (i.size > 20) || eval("#{n}.is_a? Module")
  16|    c = "[[#{c}]]"  if /^(#{mod}|Phi)\:\:/ =~ c.to_s
  17|    if cats = phi_const_cat[name.intern]
  18|      i = i + " => "+cats.collect{|cat|"[[Phi-#{cat}]]"}.join(", ")
  19|    end
  20|    [n,c,i]
  21|  }
  22|
  23|  return list.collect{|n,c,i| "* [[%s]] : %s %s" % [n,c,i]}
  24|  # 空白を調整しても空白が無視される。
  25|end
  26|
  27|if __FILE__ == $0
  28|  puts phi_const_for_wiki
  29|end

Sponsor : Cara Menaikan Posisi Website di Google | Cara Mudah Google

Target ASUS Notebook Terbaik dan Favorit

Last modified:2014/03/23 00:58:01
Keyword(s):
References:[SupportScripts]