Sha256: c07b0517c7d341fc0dd8390985c696fc1cd874a125c579d31e1ee5a08c22edd4
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal:true require 'em/pure_ruby' # Scope Rails module R2OAS module Schema class Monitor < Base def initialize(before_schema_data, options) super(options) @before_schema_data = before_schema_data end def start EM.run do ensure_save_tmp_schema_file signal_trap('INT') signal_trap('TERM') end end private attr_accessor :unit_paths_file_path def signal_trap(command) Signal.trap(command) do process_after_close_monitor EM.stop end end def process_after_close_monitor options = { type: :edited } @after_schema_data = fetch_after_schema_data analyzer = Analyzer.new(@before_schema_data, @after_schema_data, options) analyzer.analyze_docs end def ensure_save_tmp_schema_file EM.add_periodic_timer(interval_to_save_edited_tmp_schema) do @after_schema_data = fetch_after_schema_data puts "\nwait for signal trap ..." end end def fetch_after_schema_data YAML.load_file(doc_save_file_path) || @after_schema_data end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
r2-oas-0.5.0 | lib/r2-oas/schema/monitor.rb |