class Raml::Parser::Include

Attributes

path[R]

Public Instance Methods

content(cwd) click to toggle source
# File lib/raml/parser/include.rb, line 10
def content(cwd)
  pathname = @path.start_with?('/') ? @path : "#{cwd}/#{@path}"
  @content = File.open(pathname).read
  @content = YAML.load @content if is_yaml?
  @content
rescue => e
  raise Raml::CantIncludeFile, e
end
init_with(coder) click to toggle source
# File lib/raml/parser/include.rb, line 6
def init_with(coder)
  @path = coder.scalar
end

Private Instance Methods

is_yaml?() click to toggle source
# File lib/raml/parser/include.rb, line 21
def is_yaml?
  [ 'yaml', 'yml', 'raml' ].include? @path.split('.').last.downcase
end