Sha256: 40d2a87762cc21a8cd80468a258b639ed3bd75aa654cd4d04fee8f464ed488b7
Contents?: true
Size: 897 Bytes
Versions: 1
Compression:
Stored size: 897 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
swagger-core-0.3.0 | lib/swagger/v2/example.rb |