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

* lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): Symbol should

come earlier than String.

* lib/soap/mapping/rubytypeFactory.rb (RubytypeFactory::obj2soap):
  ditto.

* lib/set.rb (TC_Set::test_s_new): strings are no longer
  Enumerable

* lib/soap/property.rb (Property::load): ditto.

* lib/webrick/httputils.rb (WEBrick::HTTPUtils::parse_header): ditto.

* lib/soap/mimemessage.rb (MIMEMessage::Headers::parse): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-11-02 00:21:28 +00:00
parent 92ca42cb3e
commit 84e2f5268a
10 changed files with 37 additions and 21 deletions

View file

@ -1,3 +1,20 @@
Thu Nov 2 08:21:07 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): Symbol should
come earlier than String.
* lib/soap/mapping/rubytypeFactory.rb (RubytypeFactory::obj2soap):
ditto.
* lib/set.rb (TC_Set::test_s_new): strings are no longer
Enumerable
* lib/soap/property.rb (Property::load): ditto.
* lib/webrick/httputils.rb (WEBrick::HTTPUtils::parse_header): ditto.
* lib/soap/mimemessage.rb (MIMEMessage::Headers::parse): ditto.
Thu Nov 2 09:08:04 2006 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Nov 2 09:08:04 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c: revert lfree shift/unshift boost patch to avoid unknown * array.c: revert lfree shift/unshift boost patch to avoid unknown

View file

@ -640,7 +640,6 @@ class TC_Set < Test::Unit::TestCase
Set.new([]) Set.new([])
Set.new([1,2]) Set.new([1,2])
Set.new('a'..'c') Set.new('a'..'c')
Set.new('XYZ')
} }
assert_raises(NoMethodError) { assert_raises(NoMethodError) {
Set.new(false) Set.new(false)

View file

@ -38,6 +38,14 @@ class RubytypeFactory < Factory
def obj2soap(soap_class, obj, info, map) def obj2soap(soap_class, obj, info, map)
param = nil param = nil
case obj case obj
when ::Symbol
unless @allow_original_mapping
return nil
end
param = SOAPStruct.new(TYPE_SYMBOL)
mark_marshalled_obj(obj, param)
param.add('id', SOAPString.new(obj.id2name))
addiv2soapattr(param, obj, map)
when ::String when ::String
unless @allow_original_mapping unless @allow_original_mapping
return nil return nil
@ -185,14 +193,6 @@ class RubytypeFactory < Factory
mark_marshalled_obj(obj, param) mark_marshalled_obj(obj, param)
param.add('name', SOAPString.new(obj.name)) param.add('name', SOAPString.new(obj.name))
addiv2soapattr(param, obj, map) addiv2soapattr(param, obj, map)
when ::Symbol
unless @allow_original_mapping
return nil
end
param = SOAPStruct.new(TYPE_SYMBOL)
mark_marshalled_obj(obj, param)
param.add('id', SOAPString.new(obj.id2name))
addiv2soapattr(param, obj, map)
when ::Struct when ::Struct
unless @allow_original_mapping unless @allow_original_mapping
# treat it as an user defined class. [ruby-talk:104980] # treat it as an user defined class. [ruby-talk:104980]

View file

@ -49,7 +49,7 @@ class MIMEMessage
def parse(str) def parse(str)
header_cache = nil header_cache = nil
str.each do |line| str.lines.each do |line|
case line case line
when /^\A[^\: \t]+:\s*.+$/ when /^\A[^\: \t]+:\s*.+$/
parse_line(header_cache) if header_cache parse_line(header_cache) if header_cache

View file

@ -70,7 +70,7 @@ class Property
LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$") LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$")
def load(stream) def load(stream)
key_prefix = "" key_prefix = ""
stream.each_with_index do |line, lineno| stream.lines.each_with_index do |line, lineno|
line.sub!(/\r?\n\z/, '') line.sub!(/\r?\n\z/, '')
case line case line
when COMMENT_REGEXP when COMMENT_REGEXP

View file

@ -240,7 +240,7 @@ module WEBrick
end end
end end
begin begin
@header = HTTPUtils::parse_header(@raw_header) @header = HTTPUtils::parse_header(@raw_header.join)
rescue => ex rescue => ex
raise HTTPStatus::BadRequest, ex.message raise HTTPStatus::BadRequest, ex.message
end end

View file

@ -127,7 +127,7 @@ module WEBrick
def parse_header(raw) def parse_header(raw)
header = Hash.new([].freeze) header = Hash.new([].freeze)
field = nil field = nil
raw.each{|line| raw.lines.each{|line|
case line case line
when /^([A-Za-z0-9!\#$%&'*+\-.^_`|~]+):\s*(.*?)\s*\z/om when /^([A-Za-z0-9!\#$%&'*+\-.^_`|~]+):\s*(.*?)\s*\z/om
field, value = $1, $2 field, value = $1, $2

View file

@ -194,12 +194,12 @@ module XMLRPC
when TrueClass, FalseClass when TrueClass, FalseClass
@writer.tag("boolean", param ? "1" : "0") @writer.tag("boolean", param ? "1" : "0")
when String
@writer.tag("string", param)
when Symbol when Symbol
@writer.tag("string", param.to_s) @writer.tag("string", param.to_s)
when String
@writer.tag("string", param)
when NilClass when NilClass
if Config::ENABLE_NIL_CREATE if Config::ENABLE_NIL_CREATE
@writer.ele("nil") @writer.ele("nil")

View file

@ -129,22 +129,22 @@ module GenSupport
private private
def trim_eol(str) def trim_eol(str)
str.collect { |line| str.lines.collect { |line|
line.sub(/\r?\n\z/, "") + "\n" line.sub(/\r?\n\z/, "") + "\n"
}.join }.join
end end
def trim_indent(str) def trim_indent(str)
indent = nil indent = nil
str = str.collect { |line| untab(line) }.join str = str.lines.collect { |line| untab(line) }.join
str.each do |line| str.each_line do |line|
head = line.index(/\S/) head = line.index(/\S/)
if !head.nil? and (indent.nil? or head < indent) if !head.nil? and (indent.nil? or head < indent)
indent = head indent = head
end end
end end
return str unless indent return str unless indent
str.collect { |line| str.lines.collect { |line|
line.sub(/^ {0,#{indent}}/, "") line.sub(/^ {0,#{indent}}/, "")
}.join }.join
end end

View file

@ -54,7 +54,7 @@ class TestWEBrickCGI < Test::Unit::TestCase
assert_equal("a=1, a=2, b=x", res.body)} assert_equal("a=1, a=2, b=x", res.body)}
req = Net::HTTP::Get.new("/") req = Net::HTTP::Get.new("/")
http.request(req){|res| http.request(req){|res|
ary = res.body.to_a ary = res.body.lines.to_a
assert_match(%r{/$}, ary[0]) assert_match(%r{/$}, ary[0])
assert_match(%r{/webrick.cgi$}, ary[1]) assert_match(%r{/webrick.cgi$}, ary[1])
} }