Sha256: 90938093aa5b4ccd6154283b7e7215dda81c6b037b1902015c19c191bfd876d3

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 Bytes

Contents

autoload :YAML, 'yaml'
autoload :JSON, 'json'

module Swagger
  module Loaders
    def self.loader_for(ext)
      case ext
      when '.yaml', '.yml'
        YAMLLoader
      when '.json', '.js'
        JSONLoader
      else
        fail ArgumentError, "No registered Loader for #{ext}"
      end
    end

    class YAMLLoader
      def self.load(content)
        APIDeclaration.build(YAML.load(content))
      end
    end

    class JSONLoader
      def self.load(content)
        APIDeclaration.build(JSON.parse(content))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
swagger-core-0.2.0 lib/swagger/loaders.rb