mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/ostruct.rb (new_ostruct_member): Object#send no longer call
private methods. [ruby-dev:27044] * test/rss/test_dublincore.rb, test/rss/test_trackback.rb, test/ruby/test_eval.rb, test/socket/test_socket.rb: ditto. * test/ruby/test_lambda (test_call_with_block): lambda makes new scope for formal block parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40816e8ba2
commit
ef1ccbbc40
6 changed files with 20 additions and 8 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Tue Sep 13 08:09:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/ostruct.rb (new_ostruct_member): Object#send no longer call
|
||||
private methods. [ruby-dev:27044]
|
||||
|
||||
* test/rss/test_dublincore.rb, test/rss/test_trackback.rb,
|
||||
test/ruby/test_eval.rb, test/socket/test_socket.rb: ditto.
|
||||
|
||||
* test/ruby/test_lambda (test_call_with_block): lambda makes new scope
|
||||
for formal block parameter.
|
||||
|
||||
Tue Sep 13 01:17:45 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (proc_save_safe_level): no need to restrict safe level
|
||||
|
|
|
@ -70,9 +70,10 @@ class OpenStruct
|
|||
def new_ostruct_member(name)
|
||||
name = name.to_sym
|
||||
unless self.respond_to?(name)
|
||||
meta = class << self; self; end
|
||||
meta.send(:define_method, name) { @table[name] }
|
||||
meta.send(:define_method, :"#{name}=") { |x| @table[name] = x }
|
||||
class << self; self; end.class_eval do
|
||||
define_method(name) { @table[name] }
|
||||
define_method(:"#{name}=") { |x| @table[name] = x }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ EOR
|
|||
@elems.each do |name, value|
|
||||
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
|
||||
@parents.each do |parent|
|
||||
assert_equal(excepted, @rss.send(parent).send("dc_#{name}_elements"))
|
||||
assert_equal(excepted, @rss.send(parent).fcall("dc_#{name}_elements"))
|
||||
end
|
||||
|
||||
excepted = Array.new(2, excepted).join("\n")
|
||||
|
@ -161,7 +161,7 @@ EOR
|
|||
klass_name = "DublinCore#{Utils.to_class_name(name.to_s)}"
|
||||
klass = DublinCoreModel.const_get(klass_name)
|
||||
elems << klass.new(@rss.send(parent).send("dc_#{name}"))
|
||||
assert_equal(excepted, @rss.send(parent).send("dc_#{name}_elements"))
|
||||
assert_equal(excepted, @rss.send(parent).fcall("dc_#{name}_elements"))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ EOR
|
|||
@parents.each do |parent|
|
||||
meth = "#{RSS::TRACKBACK_PREFIX}_#{name}_element"
|
||||
meth << "s" if name == :about
|
||||
assert_equal(excepted, @rss.send(parent).send(meth))
|
||||
assert_equal(excepted, @rss.send(parent).fcall(meth))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class TestEval < Test::Unit::TestCase
|
|||
assert_nothing_raised {
|
||||
def temporally_method_for_test_eval_and_define_method(&block)
|
||||
lambda {
|
||||
class << Object.new; self end.__send__(:define_method, :zzz, &block)
|
||||
class << Object.new; self end.fcall(:define_method, :zzz, &block)
|
||||
}
|
||||
end
|
||||
v = eval("temporally_method_for_test_eval_and_define_method {}")
|
||||
|
|
|
@ -38,7 +38,7 @@ class TestLambdaParameters < Test::Unit::TestCase
|
|||
assert_equal(1, ->(&b){ b.call }.call { 1 })
|
||||
b = nil
|
||||
assert_equal(1, ->(&b){ b.call }.call { 1 })
|
||||
assert_not_nil(b)
|
||||
assert_nil(b)
|
||||
end
|
||||
|
||||
def foo
|
||||
|
|
Loading…
Reference in a new issue