Sha256: 99c8e32a4c741298944577992bb0b1e91b4627736cbfb89737c8e3a8fc7349fa

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

module OasDivider
  class SchemaObject
    attr_accessor :schema_name, :schema_object

    def initialize(schema_name, schema_object)
      @schema_name = schema_name
      @schema_object = schema_object
    end

    def to_file
      convert_ref
      YAML.dump(schema_object, File.open( File.join(directory, file_name) , 'w') )
    end

    def directory
      'components/schemas'
    end

    def file_name
      "#{schema_name}.yml"
    end

    def ref
      File.join(directory, file_name)
    end

    def convert_ref
      RelativeDocumentReferencer.execute(schema_object, 2)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oas_divider-0.2.0 lib/oas_divider/schema_object.rb
oas_divider-0.1.0 lib/oas_divider/schema_object.rb