Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/monkeypatch.rb
Instance Method Summary collapse
- #cfnize ⇒ Object
- #fnbase64 ⇒ Object
- #fngetazs ⇒ Object
- #fnimportvalue ⇒ Object (also: #fnimport)
- #fnsplit(separator = "") ⇒ Object
- #fnsub(variable_map = nil) ⇒ Object
- #fntransform(parameters = nil) ⇒ Object
- #ref(attr = nil) ⇒ Object
Instance Method Details
#cfnize ⇒ Object
42 43 44 45 |
# File 'lib/monkeypatch.rb', line 42 def cfnize return self if self !~ /_/ && self =~ /[A-Z]+.*/ split("_").map(&:capitalize).join end |
#fnbase64 ⇒ Object
79 80 81 82 83 |
# File 'lib/monkeypatch.rb', line 79 def fnbase64 { "Fn::Base64": self } end |
#fngetazs ⇒ Object
85 86 87 88 89 |
# File 'lib/monkeypatch.rb', line 85 def fngetazs { "Fn::GetAZs": self } end |
#fnimportvalue ⇒ Object Also known as: fnimport
103 104 105 106 107 |
# File 'lib/monkeypatch.rb', line 103 def fnimportvalue { "Fn::Import": self } end |
#fnsplit(separator = "") ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/monkeypatch.rb', line 70 def fnsplit(separator = "") { "Fn::Split": [ separator, self ] } end |
#fnsub(variable_map = nil) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/monkeypatch.rb', line 91 def fnsub(variable_map = nil) unless variable_map return { "Fn::Sub": self } end { "Fn::Sub": [ self, variable_map ] } end |
#fntransform(parameters = nil) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/monkeypatch.rb', line 60 def fntransform(parameters = nil) raise "fntransform parameters must be of type Hash" unless parameters.class == Hash { "Fn::Transform": { "Name": self, "Parameters": parameters } } end |
#ref(attr = nil) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/monkeypatch.rb', line 47 def ref(attr = nil) unless attr return { Ref: self } end attr = attr.class == String ? attr : attr.to_s.split("_").map(&:capitalize).join { "Fn::GetAtt": [ self, attr ] } end |