Sha256: d25ca6b3131ed6c1368e3edf3e23380f72f94c6f448ebff06b84b3dc2bf9cd51
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'eeml/libxml_eeml_parser_v005' require 'eeml/json_environment_parser_v005' require 'eeml/json_environment_parser_v006' require 'eeml/json_environment_parser_v100' 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"].to_i == Constants::EEML5_VERSION.to_i parser = JsonEnvironmentParserV005.new elsif json["version"] == Constants::JSON_1_0_0_VERSION parser = JsonEnvironmentParserV100.new elsif json["version"].to_f == Constants::EEML6_VERSION.to_f parser = JsonEnvironmentParserV006.new else raise "Invalid version specification. Permitted versions are #{Constants::EEML5_VERSION}, #{Constants::EEML6_VERSION} and #{Constants::JSON_1_0_0_VERSION}" end return parser.make_environment_from_hash(json) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eeml-0.0.17 | lib/eeml/environment_builder.rb |