Sha256: 1d078659fc2e080adfb81dab29cda644c1b45b3a9643c5395eda3f23a779a358
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'yaml' require 'hashie/dash' require 'hashie/mash' require 'hashie/extensions/coercion' module Polytrix class Manifest < Hashie::Dash class Environment < Hashie::Mash # Hashie Coercion - automatically treat all values as string def self.coerce(obj) data = obj.inject({}) do |h, (key, value)| h[key] = value.to_s h end new data end end class Suite < Hashie::Mash end class Suites < Hashie::Mash # Hashie Coercion - automatically treat all values as string def self.coerce(obj) data = obj.inject({}) do |h, (key, value)| h[key] = Polytrix::Manifest::Suite.new(value) h end new data end end include Hashie::Extensions::Coercion property :global_env coerce_key :global_env, Polytrix::Manifest::Environment property :suites coerce_key :suites, Polytrix::Manifest::Suites def self.from_yaml(yaml_file) raw_content = File.read(yaml_file) processed_content = ERB.new(raw_content).result data = YAML::load processed_content new data end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polytrix-0.0.1 | lib/polytrix/manifest.rb |