class Canals::Environment

Attributes

hostname[R]
name[R]
pem[R]
user[R]

Public Class Methods

new(args) click to toggle source
# File lib/canals/environment.rb, line 8
def initialize(args)
  @args = validate?(args)
  @name = @args[:name]
  @user = @args[:user]
  @hostname = @args[:hostname]
  @pem = @args[:pem]
end

Public Instance Methods

default=(val) click to toggle source
# File lib/canals/environment.rb, line 22
def default=(val)
  @args[:default] = !!val
end
is_default?() click to toggle source
# File lib/canals/environment.rb, line 26
def is_default?
  !!@args[:default]
end
to_hash() click to toggle source
# File lib/canals/environment.rb, line 34
def to_hash
  Marshal.load(Marshal.dump(@args))
end
to_yaml() click to toggle source
# File lib/canals/environment.rb, line 30
def to_yaml
  Canals::Tools::YAML.to_yaml(@args)
end
validate?(args) click to toggle source
# File lib/canals/environment.rb, line 16
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