Class: Raml::Parser::Include
- Inherits:
-
Object
- Object
- Raml::Parser::Include
- Defined in:
- lib/raml/parser/include.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#path ⇒ Object (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 |