summaryrefslogtreecommitdiff
path: root/lib/soap/property.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 14:41:10 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 14:41:10 +0000
commite8ed175fe02aecab21ce50e85e27fe79137d8c31 (patch)
tree8a6d14560604b592f177ffaaa0c146c756edb2e9 /lib/soap/property.rb
parent330a8e51c56f5386753f55ba8e656a62471a36ba (diff)
* added files:
* lib/soap/mapping/wsdl*.rb * lib/wsdl/soap/element.rb * lib/wsdl/xmlSchema/simpleContent.rb * modified files: * lib/soap/* * lib/wsdl/* * lib/xsd/* * test/soap/* * test/wsdl/* * test/xsd/* * sample/soap/* * sample/sdl/* * summary * imported from the soap4r repository. Version: 1.5.3-ruby1.8.2 * added several XSD basetype support: nonPositiveInteger, negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte, positiveInteger * HTTP client connection/send/receive timeout support. * HTTP client/server gzipped content encoding support. * improved WSDL schema definition support; still is far from complete, but is making step by step improovement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/soap/property.rb')
-rw-r--r--lib/soap/property.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/soap/property.rb b/lib/soap/property.rb
index 113cc64f3c..882dcc6e28 100644
--- a/lib/soap/property.rb
+++ b/lib/soap/property.rb
@@ -32,6 +32,8 @@ module SOAP
# aaa.hhh = iii
#
class Property
+ FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError
+
include Enumerable
module Util
@@ -78,8 +80,7 @@ class Property
when LINE_REGEXP
key, value = $1.strip, $2.strip
key = "#{key_prefix}.#{key}" unless key_prefix.empty?
- key = eval("\"#{key}\"")
- value = eval("\"#{value}\"")
+ key, value = loadstr(key), loadstr(value)
self[key] = value
else
raise TypeError.new(
@@ -190,7 +191,7 @@ protected
def local_referent(key)
check_lock(key)
if propkey?(@store[key]) and @store[key].locked?
- raise TypeError.new("cannot split any key from locked property")
+ raise FrozenError.new("cannot split any key from locked property")
end
@store[key]
end
@@ -199,9 +200,9 @@ protected
check_lock(key)
if @locked
if propkey?(value)
- raise TypeError.new("cannot add any key to locked property")
+ raise FrozenError.new("cannot add any key to locked property")
elsif propkey?(@store[key])
- raise TypeError.new("cannot override any key in locked property")
+ raise FrozenError.new("cannot override any key in locked property")
end
end
@store[key] = value
@@ -265,7 +266,7 @@ private
def check_lock(key)
if @locked and (key.nil? or !@store.key?(key))
- raise TypeError.new("cannot add any key to locked property")
+ raise FrozenError.new("cannot add any key to locked property")
end
end
@@ -308,6 +309,10 @@ private
load(f)
end
end
+
+ def loadstr(str)
+ str.gsub(/\\./) { |c| eval("\"#{c}\"") }
+ end
end