From eb8598146dcaa23230deceddff91e862e26d1b0f Mon Sep 17 00:00:00 2001 From: kou Date: Sun, 18 Jun 2006 08:58:18 +0000 Subject: * lib/rss/rss.rb: RSS::Element#calc_indent became to be deprecated. * lib/rss/0.9.rb: ditto. * lib/rss/1.0.rb: ditto. * lib/rss/image.rb: ditto. * lib/rss/taxonomy.rb: ditto. * lib/rss/trackback.rb: ditto. * test/rss/test_1.0.rb: removed RSS::Element.indent_size tests. * test/rss/test_2.0.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rss/0.9.rb | 18 +++++++++--------- lib/rss/1.0.rb | 22 +++++++++++----------- lib/rss/image.rb | 4 ++-- lib/rss/rss.rb | 17 ++++------------- lib/rss/taxonomy.rb | 4 ++-- lib/rss/trackback.rb | 4 ++-- 6 files changed, 30 insertions(+), 39 deletions(-) (limited to 'lib/rss') diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb index cfd2596bcc..3b193c6762 100644 --- a/lib/rss/0.9.rb +++ b/lib/rss/0.9.rb @@ -59,7 +59,7 @@ module RSS end end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent, ns_declarations) do |next_indent| [ channel_element(false, next_indent), @@ -153,7 +153,7 @@ module RSS super() end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), @@ -248,7 +248,7 @@ module RSS install_model(name, occurs) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ day_elements(false, next_indent) @@ -293,7 +293,7 @@ module RSS install_model(name, occurs) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ hour_elements(false, next_indent) @@ -355,7 +355,7 @@ module RSS self.description = description end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ url_element(false, next_indent), @@ -408,7 +408,7 @@ module RSS self.protocol = protocol end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv @@ -452,7 +452,7 @@ module RSS install_model(tag, occurs) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), @@ -561,7 +561,7 @@ module RSS self.type = type end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv @@ -642,7 +642,7 @@ module RSS self.link = link end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb index 36d6f5df87..23b4e9953c 100644 --- a/lib/rss/1.0.rb +++ b/lib/rss/1.0.rb @@ -60,7 +60,7 @@ module RSS tag_name_with_prefix(PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent, ns_declarations) do |next_indent| [ channel_element(false, next_indent), @@ -120,7 +120,7 @@ module RSS tag_name_with_prefix(PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv @@ -157,7 +157,7 @@ module RSS @li = li end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') tag(indent) do |next_indent| [ li_elements(need_convert, next_indent), @@ -217,7 +217,7 @@ module RSS @li = li end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') tag(indent) do |next_indent| [ li_elements(need_convert, next_indent), @@ -296,7 +296,7 @@ module RSS self.about = about end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), @@ -367,7 +367,7 @@ module RSS self.resource = resource end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv @@ -404,7 +404,7 @@ module RSS self.resource = resource end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv @@ -441,7 +441,7 @@ module RSS @Seq = seq end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ Seq_element(need_convert, next_indent), @@ -512,7 +512,7 @@ module RSS self.about = about end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), @@ -582,7 +582,7 @@ module RSS self.about = about end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), @@ -657,7 +657,7 @@ module RSS self.about = about end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ title_element(false, next_indent), diff --git a/lib/rss/image.rb b/lib/rss/image.rb index b81b72586f..f499a75a03 100644 --- a/lib/rss/image.rb +++ b/lib/rss/image.rb @@ -83,7 +83,7 @@ module RSS tag_name_with_prefix(IMAGE_PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ other_element(false, next_indent), @@ -187,7 +187,7 @@ module RSS tag_name_with_prefix(IMAGE_PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ other_element(false, next_indent), diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index c36cee050a..3ef5db1866 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -380,7 +380,7 @@ EOC def def_content_only_to_s module_eval(<<-EOC, *get_file_and_line_from_caller(2)) - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') if @content rv = tag(indent) do |next_indent| h(@content) @@ -445,7 +445,6 @@ EOC @tag_name = name.split(/::/).last @tag_name[0,1] = @tag_name[0,1].downcase - @indent_size = name.split(/::/).size - 2 @have_content = false def self.must_call_validators @@ -547,11 +546,6 @@ EOC def tag_name @tag_name end - - def indent_size - @indent_size - end - end attr_accessor :do_validate @@ -570,10 +564,6 @@ EOC tag_name end - def indent_size - self.class.indent_size - end - def converter=(converter) @converter = converter targets = children.dup @@ -682,9 +672,10 @@ EOC def tag_name_with_prefix(prefix) "#{prefix}:#{tag_name}" end - + + # For backward compatibility def calc_indent - INDENT * (self.class.indent_size) + '' end def maker_target(maker) diff --git a/lib/rss/taxonomy.rb b/lib/rss/taxonomy.rb index 52267133ff..93eeac7b98 100644 --- a/lib/rss/taxonomy.rb +++ b/lib/rss/taxonomy.rb @@ -81,7 +81,7 @@ module RSS target.taxo_topics end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ Bag_element(need_convert, next_indent), @@ -164,7 +164,7 @@ module RSS tag_name_with_prefix(TAXO_PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ other_element(need_convert, next_indent), diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb index ad6954f3f5..befeea1590 100644 --- a/lib/rss/trackback.rb +++ b/lib/rss/trackback.rb @@ -143,7 +143,7 @@ module RSS tag_name_with_prefix(TRACKBACK_PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv @@ -193,7 +193,7 @@ module RSS tag_name_with_prefix(TRACKBACK_PREFIX) end - def to_s(need_convert=true, indent=calc_indent) + def to_s(need_convert=true, indent='') rv = tag(indent) rv = convert(rv) if need_convert rv -- cgit v1.2.3