Class: SwaggerYard::TypeParser
- Inherits:
-
Object
- Object
- SwaggerYard::TypeParser
show all
- Defined in:
- lib/swagger_yard/type_parser.rb
Defined Under Namespace
Classes: Parser, Transform
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TypeParser.
125
126
127
128
|
# File 'lib/swagger_yard/type_parser.rb', line 125
def initialize
@parser = Parser.new
@xform = Transform.new
end
|
Instance Method Details
#json_schema(str) ⇒ Object
134
135
136
137
138
|
# File 'lib/swagger_yard/type_parser.rb', line 134
def json_schema(str)
@xform.apply(parse(str))
rescue Parslet::ParseFailed => e
raise InvalidTypeError, "'#{str}': #{e.message}"
end
|
#parse(str) ⇒ Object
130
131
132
|
# File 'lib/swagger_yard/type_parser.rb', line 130
def parse(str)
@parser.parse(str)
end
|