Class: OasContrib::Resolver::Divide

Inherits:
Base
  • Object
show all
Defined in:
lib/oas_contrib/resolver/divide.rb

Overview

Divide 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

#data, #spec

Instance Method Summary collapse

Methods inherited from Base

#file_ext_check, #input, #input_dir, #input_lambda, #output, #resolve, #v2?, #v3?

Methods included from Interface::Resolver

#resolve

Constructor Details

#initialize(infile, outdir, options) ⇒ Divide

Initialize

Parameters:

  • infile (String)

    spec file path

  • outdir (String)

    output directory path

  • options (Array)

    command options



11
12
13
14
15
16
17
# File 'lib/oas_contrib/resolver/divide.rb', line 11

def initialize(infile, outdir, options)
  @meta_dir     = outdir + '/' + DIR_NAME_META
  @path_dir     = outdir + '/' + DIR_NAME_PATH
  @model_dir    = outdir + '/' + DIR_NAME_MODEL
  @infile       = infile
  @outfile_ext  = options['out_ext']
end

Instance Method Details

#distributeBoolean

Distribute the command artifacts.

Returns:

  • (Boolean)


36
37
38
39
40
41
# File 'lib/oas_contrib/resolver/divide.rb', line 36

def distribute
  output_dir(@spec.meta,  @meta_dir)
  output_dir(@spec.path,  @path_dir)
  output_dir(@spec.model, @model_dir)
  true
end

#loadBoolean

Load and parse the input file.

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/oas_contrib/resolver/divide.rb', line 29

def load
  input(@infile)
  true
end

#setupBoolean

Setup the resolver object.

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/oas_contrib/resolver/divide.rb', line 21

def setup
  @infile_ext = File.extname(@infile)
  file_ext_check
  true
end