Class: R2OAS::Schema::Editor

Inherits:
Base show all
Extended by:
Forwardable
Defined in:
lib/r2-oas/schema/editor.rb

Constant Summary collapse

TMP_FILE_NAME =
'edited_schema'
ALERT_TEXT =
'Would you like to convert your JSON into YAML?'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before_schema_data, options) ⇒ Editor



26
27
28
29
30
31
# File 'lib/r2-oas/schema/editor.rb', line 26

def initialize(before_schema_data, options)
  super(options)
  @editor = swagger.editor
  @before_schema_data = before_schema_data
  @schema_doc_from_local = YAML.load_file(doc_save_file_path).to_yaml
end

Instance Attribute Details

#edited_schemaObject

Returns the value of attribute edited_schema.



24
25
26
# File 'lib/r2-oas/schema/editor.rb', line 24

def edited_schema
  @edited_schema
end

Instance Method Details

#startObject



33
34
35
36
37
38
39
40
41
# File 'lib/r2-oas/schema/editor.rb', line 33

def start
  EM.run do
    container.start
    open_browser_and_set_schema
    ensure_save_tmp_schema_file
    signal_trap('INT')
    signal_trap('TERM')
  end
end