Sha256: ead0713d7984eb48b0eb1b5898af23aa28d60d7d054159433dca5504f077cdc5

Contents?: true

Size: 1.28 KB

Versions: 56

Compression:

Stored size: 1.28 KB

Contents

# mdJson reader - process and direct mdJson ingest to internal data structure

# History:
#  Stan Smith 2016-06-12 refactor for mdTranslator 2.0
# 	Josh Bradley original script

require 'json'
require_relative 'version'
require_relative 'modules/module_sbJson'

module ADIWG
   module Mdtranslator
      module Readers
         module SbJson

            def self.readFile(file, hResponseObj)

               # receive json file into ruby hash
               begin
                  hSbJson = JSON.parse(file)
               rescue JSON::JSONError => err
                  hResponseObj[:readerStructurePass] = false
                  hResponseObj[:readerStructureMessages] << 'Parsing sbJson Failed - see following message(s):\n'
                  hResponseObj[:readerStructureMessages] << err.to_s.slice(0, 300)
                  return {}
               end

               # file must contain an sbJson object
               if hSbJson.empty?
                  hResponseObj[:readerStructureMessages] << 'sbJson object is empty'
                  hResponseObj[:readerStructurePass] = false
                  return {}
               end

               # load sbJson file into internal object
               return SbJson.unpack(hSbJson, hResponseObj)

            end

         end
      end
   end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.19.0.pre.beta.7 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.4 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb