Method: SOAP::Property#load

Defined in:
lib/soap/property.rb

#load(stream) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/soap/property.rb', line 77

def load(stream)
  key_prefix = ""
  stream = stream.lines if stream.respond_to?(:lines) # RubyJedi: compatible with Ruby 1.8.6 and above
  stream.each_with_index do |line, lineno|
    line.sub!(/\r?\n\z/u, '')
    case line
    when COMMENT_REGEXP
	next
    when CATDEF_REGEXP
	key_prefix = $1.strip
    when LINE_REGEXP
	key, value = $1.strip, $2.strip
	key = "#{key_prefix}.#{key}" unless key_prefix.empty?
	key, value = loadstr(key), loadstr(value)
	self[key] = value
    else
	raise TypeError.new(
 "property format error at line #{lineno + 1}: `#{line}'")
    end
  end
  self
end