class Raml::Parser
Public Class Methods
new()
click to toggle source
# File lib/raml/parser.rb, line 12 def initialize Psych.add_domain_type 'include', 'include' do |_, value| raw = File.read(value) YAML.load(raw) end end
parse(yaml)
click to toggle source
# File lib/raml/parser.rb, line 35 def self.parse(yaml) self.new.parse(yaml) end
parse_file(path)
click to toggle source
# File lib/raml/parser.rb, line 39 def self.parse_file(path) self.new.parse_file(path) end
Public Instance Methods
parse(yaml)
click to toggle source
# File lib/raml/parser.rb, line 19 def parse(yaml) raml = YAML.load(yaml) Raml::Parser::Root.new.parse(raml) end
parse_file(path)
click to toggle source
# File lib/raml/parser.rb, line 24 def parse_file(path) # Change directories so that relative file !includes work properly wd = Dir.pwd Dir.chdir File.dirname(path) raml = parse File.read(File.basename(path)) Dir.chdir wd raml end