Class: RedSnow::ParseResult
- Inherits:
-
Object
- Object
- RedSnow::ParseResult
- Defined in:
- lib/redsnow/parseresult.rb
Overview
Parse Result
Constant Summary collapse
- VERSION_KEY =
Version key
:_version
- SUPPORTED_VERSIONS =
Supported version of Api Blueprint
['2.1']
Instance Attribute Summary collapse
-
#ast ⇒ Object
Returns the value of attribute ast.
-
#error ⇒ Object
Returns the value of attribute error.
-
#sourcemap ⇒ Object
Returns the value of attribute sourcemap.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(parse_result) ⇒ ParseResult
constructor
A new instance of ParseResult.
Constructor Details
#initialize(parse_result) ⇒ ParseResult
Returns a new instance of ParseResult.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/redsnow/parseresult.rb', line 23 def initialize(parse_result) parse_result = JSON.parse(parse_result) @ast = Blueprint.new(parse_result['ast']) @sourcemap = RedSnow::Sourcemap::Blueprint.new(parse_result['sourcemap']) @warnings = [] parse_result.key?('warnings') && parse_result['warnings'].each do |warning| @warnings << source_annotation(warning) end @error = source_annotation(parse_result['error']) end |
Instance Attribute Details
#ast ⇒ Object
Returns the value of attribute ast.
11 12 13 |
# File 'lib/redsnow/parseresult.rb', line 11 def ast @ast end |
#error ⇒ Object
Returns the value of attribute error.
12 13 14 |
# File 'lib/redsnow/parseresult.rb', line 12 def error @error end |
#sourcemap ⇒ Object
Returns the value of attribute sourcemap.
14 15 16 |
# File 'lib/redsnow/parseresult.rb', line 14 def sourcemap @sourcemap end |
#warnings ⇒ Object
Returns the value of attribute warnings.
13 14 15 |
# File 'lib/redsnow/parseresult.rb', line 13 def warnings @warnings end |