1 # This is a more or less straight translation of PyYAML3000 to Ruby
3 require 'rbyaml/scanner'
4 require 'rbyaml/parser'
5 require 'rbyaml/composer'
6 require 'rbyaml/constructor'
7 require 'rbyaml/resolver'
11 attr_accessor :scanner, :parser, :composer, :constructor, :resolver
13 def initialize(stream,scanner=Scanner,parser=Parser,composer=Composer,constructor=BaseConstructor,resolver=BaseResolver)
14 @scanner = scanner.new(stream)
15 @parser = parser.new(@scanner)
16 @resolver = resolver.new
17 @composer = composer.new(@parser,@resolver)
18 @constructor = constructor.new(@composer)
22 class BaseLoader < CommonLoader
23 def initialize(stream)
24 super(stream,Scanner,Parser,Composer,BaseConstructor,BaseResolver)
28 class SafeLoader < CommonLoader
29 def initialize(stream)
30 super(stream,Scanner,Parser,Composer,SafeConstructor,Resolver)
34 class Loader < CommonLoader
35 def initialize(stream)
36 super(stream,Scanner,Parser,Composer,Constructor,Resolver)