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.
114
115
116
117
|
# File 'lib/swagger_yard/type_parser.rb', line 114
def initialize
@parser = Parser.new
@xform = Transform.new
end
|
Instance Method Details
#json_schema(str) ⇒ Object
123
124
125
126
127
|
# File 'lib/swagger_yard/type_parser.rb', line 123
def json_schema(str)
@xform.apply(parse(str))
rescue Parslet::ParseFailed => e
raise ArgumentError, "invalid type: #{e.message}"
end
|
#parse(str) ⇒ Object
119
120
121
|
# File 'lib/swagger_yard/type_parser.rb', line 119
def parse(str)
@parser.parse(str)
end
|