Rubyで遊んだ日々の記録。あくまで著者視点の私的な記録なので、正確さを求めないように。
Rubyと関係ない話題にはその旨注記しているはず。なので、一見関係無いように見える話題もどこかで関係あるのかもしれません。または、注記の書き忘れかもしれません...
_ 書くのを忘れてたけど、いつものようにミラーしてある。
md5sumなどは各自確認すること(参照:[ruby-list:43017])。
_ riでクラスの属性(つまりattr_*で指定されたインスタンス変数)を引こうとしても引けないということにいきなり気付いてしまった。
パッチを作ってみたものの、仕組み上死ぬほど遅いので、ダメだこりゃ。
いちおうこんなの。
Index: lib/rdoc/ri/ri_cache.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_cache.rb,v
retrieving revision 1.8
diff -u -1 -p -r1.8 ri_cache.rb
--- lib/rdoc/ri/ri_cache.rb 30 Aug 2004 14:20:57 -0000 1.8
+++ lib/rdoc/ri/ri_cache.rb 7 Dec 2006 08:29:39 -0000
@@ -14,2 +14,3 @@ module RI
@inferior_classes = []
+ @attributes = []
end
@@ -36,3 +37,3 @@ module RI
- if name =~ /^(.*?)-(c|i).yaml$/
+ if /^(.*?)-(c|i)\.yaml$/ =~ name
external_name = $1
@@ -43,2 +44,4 @@ module RI
list << MethodEntry.new(path, internal_name, is_class_method, self)
+ elsif /^cdesc-.*?\.yaml$/ =~ name
+ @attributes.concat(YAML.load_file(File.join(dir, name)).attributes.map{|a| a.full_name = full_name + "\##{a.name}"; a})
else
@@ -116,5 +119,5 @@ module RI
list = case is_class_method
- when nil then @class_methods + @instance_methods
+ when nil then @class_methods + @instance_methods + @attributes
when true then @class_methods
- when false then @instance_methods
+ when false then @instance_methods + @attributes
else fail "Unknown is_class_method: #{is_class_method.inspect}"
Index: lib/rdoc/ri/ri_descriptions.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_descriptions.rb,v
retrieving revision 1.8
diff -u -1 -p -r1.8 ri_descriptions.rb
--- lib/rdoc/ri/ri_descriptions.rb 14 Jun 2006 22:24:36 -0000 1.8
+++ lib/rdoc/ri/ri_descriptions.rb 7 Dec 2006 08:29:39 -0000
@@ -33,2 +33,3 @@ module RI
attr_reader :rw, :comment
+ attr_accessor :full_name
def initialize(name, rw, comment)
Index: lib/rdoc/ri/ri_display.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_display.rb,v
retrieving revision 1.6
diff -u -1 -p -r1.6 ri_display.rb
--- lib/rdoc/ri/ri_display.rb 24 Mar 2004 19:17:13 -0000 1.6
+++ lib/rdoc/ri/ri_display.rb 7 Dec 2006 08:29:39 -0000
@@ -63,3 +63,3 @@ class DefaultDisplay
display_flow(method.comment)
- if method.aliases && !method.aliases.empty?
+ if method.respond_to?(:aliases) && method.aliases && !method.aliases.empty?
@formatter.blankline
@@ -135,3 +135,3 @@ class DefaultDisplay
@formatter.blankline
- @formatter.wrap("Attributes:", "")
+ @formatter.display_heading("Attributes:", 2, "")
@formatter.wrap(klass.attributes.map{|a| a.name}.sort.join(', '))
@@ -224,10 +224,14 @@ class DefaultDisplay
- params = method.params
+ if method.respond_to?(:params)
+ params = method.params
- if params[0,1] == "("
- if method.is_singleton
- params = method.full_name + params
- else
- params = method.name + params
+ if params[0,1] == "("
+ if method.is_singleton
+ params = method.full_name + params
+ else
+ params = method.name + params
+ end
end
+ elsif method.respond_to?(:rw)
+ params = "[#{method.rw}] #{method.name}"
end
Index: lib/rdoc/ri/ri_reader.rb
===================================================================
RCS file: /home/cvs/ruby/lib/rdoc/ri/ri_reader.rb,v
retrieving revision 1.7
diff -u -1 -p -r1.7 ri_reader.rb
--- lib/rdoc/ri/ri_reader.rb 30 Aug 2004 14:20:57 -0000 1.7
+++ lib/rdoc/ri/ri_reader.rb 7 Dec 2006 08:29:39 -0000
@@ -44,4 +44,8 @@ module RI
def get_method(method_entry)
- path = method_entry.path_name
- File.open(path) { |f| RI::Description.deserialize(f) }
+ if method_entry.respond_to?(:path_name)
+ path = method_entry.path_name
+ File.open(path) { |f| RI::Description.deserialize(f) }
+ else
+ method_entry
+ end
end
被捕捉アンテナ類
[Ant]
[Antenna-Julia]
[Rabbit's Antenna]
[Ruby hotlinks]