module Fakeit::Openapi
Public Class Methods
load(src)
click to toggle source
# File lib/fakeit/openapi/loader.rb, line 4 def load(src) URI .open(src, &:read) .then { parse(src, _1) } .then(&OpenAPIParser.method(:parse)) end
Private Class Methods
parse(src, content)
click to toggle source
# File lib/fakeit/openapi/loader.rb, line 13 def parse(src, content) case File.extname(src) when '.json' JSON.parse(content) when '.yml', '.yaml' YAML.safe_load(content, [Date, Time]) else raise 'Invalid openapi specification file' end end