From edcaae97415aef8e34924b696570c7a28669d39d Mon Sep 17 00:00:00 2001 From: tenderlove Date: Sat, 24 Apr 2010 00:20:08 +0000 Subject: [PATCH] * ext/psych/lib/psych.rb: fixing documentation * ext/psych/lib/psych/deprecated.rb: moving deprecated method to deprecated file git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych.rb | 11 +---------- ext/psych/lib/psych/deprecated.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 42cd8877be..58c77f40fd 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -191,21 +191,12 @@ module Psych # Load multiple documents given in +yaml+. Returns the parsed documents # as a list. For example: # - # Psych.load_documents("--- foo\n...\n--- bar\n...") # => ['foo', 'bar'] + # Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar'] # def self.load_stream yaml parse_stream(yaml).children.map { |child| child.to_ruby } end - def self.load_documents yaml, &block - if $VERBOSE - warn "#{caller[0]}: load_documents is deprecated, use load_stream" - end - list = load_stream yaml - return list unless block_given? - list.each(&block) - end - ### # Load the document contained in +filename+. Returns the yaml contained in # +filename+ as a ruby object diff --git a/ext/psych/lib/psych/deprecated.rb b/ext/psych/lib/psych/deprecated.rb index 26e431dd81..093f145302 100644 --- a/ext/psych/lib/psych/deprecated.rb +++ b/ext/psych/lib/psych/deprecated.rb @@ -20,6 +20,16 @@ module Psych end target.psych_to_yaml unless opts[:nodump] end + + def self.load_documents yaml, &block + if $VERBOSE + warn "#{caller[0]}: load_documents is deprecated, use load_stream" + end + list = load_stream yaml + return list unless block_given? + list.each(&block) + end + end class Object