Class: Raml::Parser::Include

Inherits:
Object
  • Object
show all
Defined in:
lib/raml/parser/include.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/raml/parser/include.rb', line 4

def path
  @path
end

Instance Method Details

#content(cwd) ⇒ Object



10
11
12
13
14
15
16
17
# 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) ⇒ Object



6
7
8
# File 'lib/raml/parser/include.rb', line 6

def init_with(coder)
  @path = coder.scalar
end