Sha256: e46b54d0e44ed197b4afccc6c6103f517bf3ec588fc260ca8838b67f0e62cd07
Contents?: true
Size: 771 Bytes
Versions: 9
Compression:
Stored size: 771 Bytes
Contents
module Fakeit module Openapi class Specification def initialize(spec_file) @spec_file = spec_file @mtime = File.mtime(spec_file) if File.exist?(spec_file) @doc = Fakeit::Openapi.load(spec_file) end def operation(method, path, options) reload_spec if @mtime @doc .request_operation(method, path) &.then { Operation.new(_1, options) } end private def reload_spec new_mtime = File.mtime(@spec_file) return if @mtime == new_mtime @mtime = new_mtime @doc = Fakeit::Openapi.load(@spec_file) rescue StandardError => _e Logger.warn(Rainbow('Invalid spec file, use previous snapshot instead').red) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems