Class: OasContrib::Resolver::Merge
- Defined in:
- lib/oas_contrib/resolver/merge.rb
Overview
Merge command resolver class
Constant Summary
Constants inherited from Base
Base::DEFINED_FILE_EXT, Base::DIR_NAME_META, Base::DIR_NAME_MODEL, Base::DIR_NAME_PATH
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#distribute ⇒ Boolean
Distribute the command artifacts.
-
#initialize(indir, outfile, options) ⇒ Merge
constructor
Initialize.
-
#load ⇒ Boolean
Load and parse the input files.
-
#setup ⇒ Boolean
Setup the resolver object.
Methods inherited from Base
#file_ext_check, #input, #input_dir, #input_lambda, #output, #resolve, #v2?, #v3?
Methods included from Interface::Resolver
Constructor Details
#initialize(indir, outfile, options) ⇒ Merge
Initialize
11 12 13 14 15 16 17 |
# File 'lib/oas_contrib/resolver/merge.rb', line 11 def initialize(indir, outfile, ) @meta_dir = indir + '/' + DIR_NAME_META @path_dir = indir + '/' + DIR_NAME_PATH @model_dir = indir + '/' + DIR_NAME_MODEL @outfile = outfile @infile_ext = ['in_ext'] end |
Instance Method Details
#distribute ⇒ Boolean
Distribute the command artifacts.
40 41 42 43 |
# File 'lib/oas_contrib/resolver/merge.rb', line 40 def distribute output(@data, @outfile) true end |
#load ⇒ Boolean
Load and parse the input files.
29 30 31 32 33 34 35 36 |
# File 'lib/oas_contrib/resolver/merge.rb', line 29 def load @data = input_dir(@meta_dir) resolve @data['paths'] = input_dir(@path_dir) @data['definitions'] = input_dir(@model_dir) if v2? @data['components'] = { 'schemas' => input_dir(@model_dir) } if v3? true end |
#setup ⇒ Boolean
Setup the resolver object.
21 22 23 24 25 |
# File 'lib/oas_contrib/resolver/merge.rb', line 21 def setup @outfile_ext = File.extname(@outfile) file_ext_check true end |