Sha256: c56230b9ef83f5ee70dc3ba3859291d1db0886bbb3de7b942620cdc913ccb357
Contents?: true
Size: 947 Bytes
Versions: 1
Compression:
Stored size: 947 Bytes
Contents
module Swagger module V2 # A class to represent example objects in the Swagger schema. # Usually used to represent example request or responses. # Provides access to both the raw example or a parsed representation. class Example extend Forwardable def_delegator :@raw, :to_s, :inspect # The example as it appears in the Swagger document. # @return Object the example attr_reader :raw def initialize(sample) @raw = sample end # The example after it has been parsed to match the +media_type+. # @param media_type [String] the target media_type # @return [Object] an object according to the +media_type+ def parse(media_type = 'application/json') return @raw unless @raw.is_a? String parser = Swagger::MIMEType.parser_for(media_type) parser.parse(@raw) end def inspect @raw.inspect end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
swagger-core-0.2.1 | lib/swagger/v2/example.rb |