Sha256: df1a6ec20e45451067e4676611ed8ac4f8117ff704ea5845c64e4d454d8bbfba

Contents?: true

Size: 920 Bytes

Versions: 2

Compression:

Stored size: 920 Bytes

Contents

require 'eeml/libxml_eeml_parser_v005'
require 'eeml/json_environment_parser_v005'
require 'eeml/json_environment_parser_v006'

module Eeml
  class EnvironmentBuilder # :nodoc:
    def self.build_from_xml(xml_str)
      parser = LibXMLEemlParserV005.new
      return parser.make_environment_from_xml(xml_str)
    end

    def self.build_list_from_xml(xml_str)
      parser = LibXMLEemlParserV005.new
      return parser.make_environments_from_xml(xml_str)
    end

    def self.build_from_json(json_str)
      json = JSON.parse(json_str)
      if json["version"] == EEML5_VERSION
        parser = JsonEnvironmentParserV005.new
      elsif json["version"] == EEML6_VERSION
        parser = JsonEnvironmentParserV006.new
      else
        raise "Invalid version specification. Permitted versions are #{EEML5_VERSION} and #{EEML6_VERSION}"
      end
      return parser.make_environment_from_hash(json)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eeml-0.0.9 lib/eeml/environment_builder.rb
eeml-0.0.8 lib/eeml/environment_builder.rb