lib/soap/property.rb in rubyjedi-soap4r-1.5.8.20100619003610 vs lib/soap/property.rb in rubyjedi-soap4r-2.0.2.1

- old
+ new

@@ -1,6 +1,6 @@ -# encoding: ASCII-8BIT +# encoding: UTF-8 # soap/property.rb: SOAP4R - Property implementation. # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -74,11 +74,15 @@ CATDEF_REGEXP = Regexp.new("^\\[\\s*#{KEY_REGSRC}\\s*\\]$") # RubyJedi: Attempt at 1.9 Compatibility // , nil, 'u') LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$") # RubyJedi: Attempt at 1.9 Compatibility // , nil, 'u') def load(stream) key_prefix = "" - stream = stream.lines if stream.respond_to?(:lines) # RubyJedi: compatible with Ruby 1.8.6 and above + if stream.respond_to?(:each_line) # Ruby 1.9 and beyond + stream = stream.each_line + elsif stream.respond_to?(:lines) # RubyJedi: compatible with Ruby 1.8.6 + stream = stream.lines + end stream.each_with_index do |line, lineno| line.sub!(/\r?\n\z/u, '') case line when COMMENT_REGEXP next @@ -321,20 +325,6 @@ str.gsub(/\\./u) { |c| eval("\"#{c}\"") } end end -end - - -# for ruby/1.6. -#unless Enumerable.instance_methods.include?(:inject) -# module Enumerable -# def inject(init) -# result = init -# each do |item| -# result = yield(result, item) -# end -# result -# end -# end -#end +end \ No newline at end of file