1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2004-11-28 06:59:34 +00:00
parent b684f87574
commit 0c616db7ff
6 changed files with 22 additions and 14 deletions

View file

@ -1,3 +1,11 @@
Sun Nov 28 15:57:58 2004 Kouhei Sutou <kou@cozmixng.org>
* 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 <kou@cozmixng.org> Sun Nov 28 15:51:40 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/rss.rb (RSS::NotSetError): added. * lib/rss/rss.rb (RSS::NotSetError): added.

View file

@ -309,7 +309,7 @@ module RSS
@content = content @content = content
end end
undef :content= remove_method :content=
def content=(value) def content=(value)
@content = value.to_i @content = value.to_i
end end

View file

@ -11,7 +11,7 @@ module RSS
install_model(x, '?') install_model(x, '?')
end end
undef :ttl= remove_method :ttl=
def ttl=(value) def ttl=(value)
@ttl = value.to_i @ttl = value.to_i
end end

View file

@ -186,7 +186,7 @@ EOC
end end
private private
undef make_xml_stylesheets remove_method :make_xml_stylesheets
def make_xml_stylesheets def make_xml_stylesheets
XMLStyleSheets.new(self) XMLStyleSheets.new(self)
end end

View file

@ -517,7 +517,7 @@ EOC
end end
end end
def tag(indent, additional_attrs=[]) def tag(indent, additional_attrs=[], &block)
next_indent = indent + INDENT next_indent = indent + INDENT
attrs = collect_attrs attrs = collect_attrs
@ -525,9 +525,9 @@ EOC
attrs += additional_attrs attrs += additional_attrs
start_tag = make_start_tag(indent, next_indent, attrs) start_tag = make_start_tag(indent, next_indent, attrs)
if block_given? if block
content = yield(next_indent) content = block.call(next_indent)
else else
content = [] content = []
end end
@ -794,9 +794,9 @@ EOC
end end
private private
def tag(indent, attrs) def tag(indent, attrs, &block)
rv = xmldecl + xml_stylesheet_pi rv = xmldecl + xml_stylesheet_pi
rv << super rv << super(indent, attrs, &block)
rv rv
end end

View file

@ -53,12 +53,12 @@ module RSS
klass_name = x.capitalize klass_name = x.capitalize
klass.install_have_child_element(var_name) klass.install_have_child_element(var_name)
klass.module_eval(<<-EOC, __FILE__, __LINE__) klass.module_eval(<<-EOC, __FILE__, __LINE__)
undef #{var_name} remove_method :#{var_name}
def #{var_name} def #{var_name}
@#{var_name} and @#{var_name}.value @#{var_name} and @#{var_name}.value
end end
undef #{var_name}= remove_method :#{var_name}=
def #{var_name}=(value) def #{var_name}=(value)
@#{var_name} = new_with_value_if_need(#{klass_name}, value) @#{var_name} = new_with_value_if_need(#{klass_name}, value)
end end
@ -70,7 +70,7 @@ module RSS
klass_name = name.capitalize klass_name = name.capitalize
klass.install_have_children_element(var_name) klass.install_have_children_element(var_name)
klass.module_eval(<<-EOC, __FILE__, __LINE__) klass.module_eval(<<-EOC, __FILE__, __LINE__)
undef #{var_name} remove_method :#{var_name}
def #{var_name}(*args) def #{var_name}(*args)
if args.empty? if args.empty?
@#{var_name}.first and @#{var_name}.first.value @#{var_name}.first and @#{var_name}.first.value
@ -84,8 +84,8 @@ module RSS
end end
end end
undef #{var_name}= remove_method :#{var_name}=
undef set_#{var_name} remove_method :set_#{var_name}
def #{var_name}=(*args) def #{var_name}=(*args)
if args.size == 1 if args.size == 1
item = new_with_value_if_need(#{klass_name}, args[0]) item = new_with_value_if_need(#{klass_name}, args[0])