diff --git a/ChangeLog b/ChangeLog index 248e7a0f29..4f7c3b0d64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Nov 28 15:57:58 2004 Kouhei Sutou + + * lib/rss/rss.rb (RSS::Element#tag): not use block_given? for + working with ruby 1.6 again. + + * lib/rss/{0.9,2.0,trackback}.rb, lib/rss/maker/base.rb: + undef -> remove_method for working with ruby 1.6 again. + Sun Nov 28 15:51:40 2004 Kouhei Sutou * lib/rss/rss.rb (RSS::NotSetError): added. diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb index b80ad193a3..797a46ca3b 100644 --- a/lib/rss/0.9.rb +++ b/lib/rss/0.9.rb @@ -309,7 +309,7 @@ module RSS @content = content end - undef :content= + remove_method :content= def content=(value) @content = value.to_i end diff --git a/lib/rss/2.0.rb b/lib/rss/2.0.rb index 5793b35938..19cb487d79 100644 --- a/lib/rss/2.0.rb +++ b/lib/rss/2.0.rb @@ -11,7 +11,7 @@ module RSS install_model(x, '?') end - undef :ttl= + remove_method :ttl= def ttl=(value) @ttl = value.to_i end diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb index 9b633f4695..93f668beff 100644 --- a/lib/rss/maker/base.rb +++ b/lib/rss/maker/base.rb @@ -186,7 +186,7 @@ EOC end private - undef make_xml_stylesheets + remove_method :make_xml_stylesheets def make_xml_stylesheets XMLStyleSheets.new(self) end diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index 9bf94986e7..c180a70b5d 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -517,7 +517,7 @@ EOC end end - def tag(indent, additional_attrs=[]) + def tag(indent, additional_attrs=[], &block) next_indent = indent + INDENT attrs = collect_attrs @@ -525,9 +525,9 @@ EOC attrs += additional_attrs start_tag = make_start_tag(indent, next_indent, attrs) - - if block_given? - content = yield(next_indent) + + if block + content = block.call(next_indent) else content = [] end @@ -794,9 +794,9 @@ EOC end private - def tag(indent, attrs) + def tag(indent, attrs, &block) rv = xmldecl + xml_stylesheet_pi - rv << super + rv << super(indent, attrs, &block) rv end diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb index 1bcc60404d..8bc1ee5ad5 100644 --- a/lib/rss/trackback.rb +++ b/lib/rss/trackback.rb @@ -53,12 +53,12 @@ module RSS klass_name = x.capitalize klass.install_have_child_element(var_name) klass.module_eval(<<-EOC, __FILE__, __LINE__) - undef #{var_name} + remove_method :#{var_name} def #{var_name} @#{var_name} and @#{var_name}.value end - undef #{var_name}= + remove_method :#{var_name}= def #{var_name}=(value) @#{var_name} = new_with_value_if_need(#{klass_name}, value) end @@ -70,7 +70,7 @@ module RSS klass_name = name.capitalize klass.install_have_children_element(var_name) klass.module_eval(<<-EOC, __FILE__, __LINE__) - undef #{var_name} + remove_method :#{var_name} def #{var_name}(*args) if args.empty? @#{var_name}.first and @#{var_name}.first.value @@ -84,8 +84,8 @@ module RSS end end - undef #{var_name}= - undef set_#{var_name} + remove_method :#{var_name}= + remove_method :set_#{var_name} def #{var_name}=(*args) if args.size == 1 item = new_with_value_if_need(#{klass_name}, args[0])