Class: Bosh::AwsCliPlugin::MigrationHelper::Template
- Inherits:
-
Object
- Object
- Bosh::AwsCliPlugin::MigrationHelper::Template
- Defined in:
- lib/bosh_cli_plugin_aws/migration_helper.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timestamp_string ⇒ Object
readonly
Returns the value of attribute timestamp_string.
Instance Method Summary collapse
- #file_prefix ⇒ Object
-
#initialize(name) ⇒ Template
constructor
A new instance of Template.
- #render(template_name = "aws_migration") ⇒ Object
Constructor Details
#initialize(name) ⇒ Template
Returns a new instance of Template.
7 8 9 10 11 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 7 def initialize(name) @timestamp_string = Time.new.getutc.strftime("%Y%m%d%H%M%S") @name = name @class_name = MigrationHelper.to_class_name(name) end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 5 def class_name @class_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 5 def name @name end |
#timestamp_string ⇒ Object (readonly)
Returns the value of attribute timestamp_string.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 5 def @timestamp_string end |
Instance Method Details
#file_prefix ⇒ Object
13 14 15 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 13 def file_prefix "#{}_#{name}" end |
#render(template_name = "aws_migration") ⇒ Object
17 18 19 20 21 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 17 def render(template_name = "aws_migration") template_file_path = File.("../../templates/#{template_name}.erb", File.dirname(__FILE__)) template = ERB.new(File.new(template_file_path).read(), 0, '<>%-') template.result(binding) end |