class Raml::Parser::Response
Attributes
attributes[RW]
response[RW]
Public Instance Methods
parse(code, attributes)
click to toggle source
# File lib/raml/parser/response.rb, line 13 def parse(code, attributes) @response = Raml::Response.new(code) @attributes = prepare_attributes(attributes) parse_attributes response end
Private Instance Methods
parse_attributes()
click to toggle source
# File lib/raml/parser/response.rb, line 22 def parse_attributes attributes.each do |key, value| key = underscore(key) case key when 'body' parse_bodies(value) when 'description' response.description = value else raise UnknownAttributeError.new "Unknown response key: #{key}" end end if attributes end
parse_bodies(bodies)
click to toggle source
# File lib/raml/parser/response.rb, line 36 def parse_bodies(bodies) bodies.each do |type, body_attributes| response.bodies << Raml::Parser::Body.new.parse(type, body_attributes) end end