summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-04-23 18:22:20 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-04-23 18:22:20 -0700
commitb5b0c71e22b4e308e2bde4ebd56412626e0e5480 (patch)
treef72da8d09a9593f2b746656edaacbcd6ff835bd2 /lib
parente0e3ea15ea29271645f15e700dba96fab0d3628f (diff)
downloadpsych-b5b0c71e22b4e308e2bde4ebd56412626e0e5480.zip
merging from ruby
Diffstat (limited to 'lib')
-rw-r--r--lib/psych.rb11
-rw-r--r--lib/psych/deprecated.rb10
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/psych.rb b/lib/psych.rb
index 42cd887..58c77f4 100644
--- a/lib/psych.rb
+++ b/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/lib/psych/deprecated.rb b/lib/psych/deprecated.rb
index 26e431d..093f145 100644
--- a/lib/psych/deprecated.rb
+++ b/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