Sha256: 8a008853852e1d4b2fabbc470b4fa58f791b547c84df69dbaf75d33cb0940f68
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 Bytes
Contents
require 'canals/tools/yaml' module Canals class CanalEnvironmentError < StandardError; end class Environment attr_reader :name, :user, :hostname, :pem def initialize(args) @args = validate?(args) @name = @args[:name] @user = @args[:user] @hostname = @args[:hostname] @pem = @args[:pem] end def validate?(args) vargs = args.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} raise CanalEnvironmentError.new("Missing option: \"name\" in environment creation") if vargs[:name].nil? vargs end def default=(val) @args[:default] = !!val end def is_default? !!@args[:default] end def to_yaml Canals::Tools::YAML.to_yaml(@args) end def to_hash Marshal.load(Marshal.dump(@args)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
canals-0.9.1 | lib/canals/environment.rb |