Sha256: 1530f854402e021fa87a598d1421b10f2b4b9d05796dc299ba5507b96ab6967e
Contents?: true
Size: 798 Bytes
Versions: 3
Compression:
Stored size: 798 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| Operation.new(operation, 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 Fakeit::Logger.warn(Rainbow('Invalid spec file, use previous snapshot instead').red) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fakeit-0.4.2 | lib/fakeit/openapi/specification.rb |
fakeit-0.4.1 | lib/fakeit/openapi/specification.rb |
fakeit-0.4.0 | lib/fakeit/openapi/specification.rb |