Module: DrawCloud::Utilities

Included in:
Base
Defined in:
lib/draw_cloud/utilities.rb

Instance Method Summary collapse

Instance Method Details

#desplice(string) ⇒ Object



45
46
47
# File 'lib/draw_cloud/utilities.rb', line 45

def desplice(string)
  fnjoin("", *string.split('|CHOPHERE|').collect {|s| if s.start_with? 'YYYY' then YAML::load(s[4,s.length-4]) else s end })
end

#fnbase64(arg) ⇒ Object



33
34
35
# File 'lib/draw_cloud/utilities.rb', line 33

def fnbase64(arg)
  Base64Func.new(arg)
end

#fngetatt(resource, attribute_name) ⇒ Object



29
30
31
# File 'lib/draw_cloud/utilities.rb', line 29

def fngetatt(resource, attribute_name)
  GetAttFunc.new(resource, attribute_name)
end

#fnjoin(delimiter, *args) ⇒ Object



37
38
39
# File 'lib/draw_cloud/utilities.rb', line 37

def fnjoin(delimiter, *args)
  JoinFunc.new(delimiter, args)
end

#hash_to_tag_array(hash) ⇒ Object



61
62
63
# File 'lib/draw_cloud/utilities.rb', line 61

def hash_to_tag_array(hash)
  hash.collect {|(k,v)| {"Key" => k, "Value" => v} }
end

#regionObject



21
22
23
# File 'lib/draw_cloud/utilities.rb', line 21

def region
  SimpleRef.new("AWS::Region")
end

#resource_style(str) ⇒ Object



41
42
43
# File 'lib/draw_cloud/utilities.rb', line 41

def resource_style(str)
  DrawCloud.resource_style(str)
end

#splice(string) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/draw_cloud/utilities.rb', line 49

def splice(string)
  out = '|CHOPHERE|'
  outref = DrawCloud.ref(string)
  case outref
  when String
    out += outref
  else
    out += 'YYYY' + YAML::dump(outref)
  end
  out += '|CHOPHERE|'
end

#stack_nameObject



25
26
27
# File 'lib/draw_cloud/utilities.rb', line 25

def stack_name
  SimpleRef.new("AWS::StackName")
end