зеркало из https://github.com/github/ruby.git
* 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:
Родитель
b684f87574
Коммит
0c616db7ff
|
@ -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>
|
||||
|
||||
* lib/rss/rss.rb (RSS::NotSetError): added.
|
||||
|
|
|
@ -309,7 +309,7 @@ module RSS
|
|||
@content = content
|
||||
end
|
||||
|
||||
undef :content=
|
||||
remove_method :content=
|
||||
def content=(value)
|
||||
@content = value.to_i
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module RSS
|
|||
install_model(x, '?')
|
||||
end
|
||||
|
||||
undef :ttl=
|
||||
remove_method :ttl=
|
||||
def ttl=(value)
|
||||
@ttl = value.to_i
|
||||
end
|
||||
|
|
|
@ -186,7 +186,7 @@ EOC
|
|||
end
|
||||
|
||||
private
|
||||
undef make_xml_stylesheets
|
||||
remove_method :make_xml_stylesheets
|
||||
def make_xml_stylesheets
|
||||
XMLStyleSheets.new(self)
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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])
|
||||
|
|
Загрузка…
Ссылка в новой задаче