Class: CFnDK::ErbString

Inherits:
Object
  • Object
show all
Defined in:
lib/cfndk/erb_string.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, option) ⇒ ErbString

Returns a new instance of ErbString.



4
5
6
7
8
# File 'lib/cfndk/erb_string.rb', line 4

def initialize(str, option)
  @erb = ERB.new(str, nil, '-')
  @properties = option[:properties]
  @uuid = option[:uuid]
end

Instance Attribute Details

#propertiesObject (readonly)

Returns the value of attribute properties.



3
4
5
# File 'lib/cfndk/erb_string.rb', line 3

def properties
  @properties
end

#uuidObject (readonly)

Returns the value of attribute uuid.



3
4
5
# File 'lib/cfndk/erb_string.rb', line 3

def uuid
  @uuid
end

Instance Method Details

#append_uuid(glue = '-') ⇒ Object



14
15
16
17
18
19
20
# File 'lib/cfndk/erb_string.rb', line 14

def append_uuid(glue = '-')
  if uuid
    glue + uuid
  else
    ''
  end
end

#valueObject



10
11
12
# File 'lib/cfndk/erb_string.rb', line 10

def value
  @erb.result(binding)
end