diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 09:20:47 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 09:20:47 +0000 |
commit | 7ead69e5b3a2b09878037f11a7dda59ae402ccbf (patch) | |
tree | f7a422e5983f2c475c831e5d70987437eb77fa69 /lib/rss/converter.rb | |
parent | 2639d6dc809a3f78c96543c839d72d05e6e90ca7 (diff) | |
download | ruby-7ead69e5b3a2b09878037f11a7dda59ae402ccbf.tar.gz |
* test/rss/test_xml-stylesheet.rb: added tests for xml-stylesheet.
* lib/rss/xml-stylesheet.rb: added xml-stylesheet parsing
function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/converter.rb')
-rw-r--r-- | lib/rss/converter.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/rss/converter.rb b/lib/rss/converter.rb index 5037606f37..9a62431a9e 100644 --- a/lib/rss/converter.rb +++ b/lib/rss/converter.rb @@ -25,8 +25,8 @@ module RSS value end - def def_convert() - instance_eval(<<-EOC, *get_file_and_line_from_caller(0)) + def def_convert(depth=0) + instance_eval(<<-EOC, *get_file_and_line_from_caller(depth)) def convert(value) if value.kind_of?(String) #{yield('value')} @@ -37,10 +37,10 @@ module RSS EOC end - def def_iconv_convert(to_enc, from_enc) + def def_iconv_convert(to_enc, from_enc, depth=0) begin require "iconv" - def_convert do |value| + def_convert(depth+1) do |value| <<-EOC @iconv ||= Iconv.new("#{to_enc}", "#{from_enc}") begin @@ -68,7 +68,7 @@ module RSS def def_uconv_convert_if_can(meth, to_enc, from_enc) begin require "uconv" - def_convert do |value| + def_convert(1) do |value| <<-EOC begin Uconv.#{meth}(#{value}) @@ -78,7 +78,7 @@ module RSS EOC end rescue LoadError - def_iconv_convert(to_enc, from_enc) + def_iconv_convert(to_enc, from_enc, 1) end end |