Skip to content
Browse files

merging from ruby

  • Loading branch information...
1 parent e0e3ea1 commit b5b0c71e22b4e308e2bde4ebd56412626e0e5480 @tenderlove committed Apr 23, 2010
Showing with 14 additions and 10 deletions.
  1. +1 −10 lib/psych.rb
  2. +10 −0 lib/psych/deprecated.rb
  3. +3 −0 test/psych/test_yaml.rb
View
11 lib/psych.rb
@@ -191,21 +191,12 @@ def self.to_json o
# 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
View
10 lib/psych/deprecated.rb
@@ -20,6 +20,16 @@ def self.quick_emit thing, opts = {}, &block # :nodoc:
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
View
3 test/psych/test_yaml.rb
@@ -10,6 +10,9 @@ module Psych_Tests
end
class Psych_Unit_Tests < Psych::TestCase
+ def teardown
+ Psych.domain_types.clear
+ end
#
# Tests modified from 00basic.t in Psych.pm
#

0 comments on commit b5b0c71

Please sign in to comment.
Something went wrong with that request. Please try again.