Class: ChatopsDeployer::Template
- Inherits:
-
Object
- Object
- ChatopsDeployer::Template
- Defined in:
- lib/chatops_deployer/template.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#vault ⇒ Object
readonly
Returns the value of attribute vault.
Instance Method Summary collapse
-
#initialize(input_file_path) ⇒ Template
constructor
A new instance of Template.
- #inject(env) ⇒ Object
- #write(output_file_path) ⇒ Object
Constructor Details
#initialize(input_file_path) ⇒ Template
Returns a new instance of Template.
7 8 9 10 11 |
# File 'lib/chatops_deployer/template.rb', line 7 def initialize(input_file_path) @erb = ERB.new(File.read(input_file_path)) @env = {} @vault = ChatopsDeployer::Vault.new end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/chatops_deployer/template.rb', line 5 def env @env end |
#vault ⇒ Object (readonly)
Returns the value of attribute vault.
5 6 7 |
# File 'lib/chatops_deployer/template.rb', line 5 def vault @vault end |
Instance Method Details
#inject(env) ⇒ Object
13 14 15 16 |
# File 'lib/chatops_deployer/template.rb', line 13 def inject(env) @env = env self end |
#write(output_file_path) ⇒ Object
18 19 20 21 22 |
# File 'lib/chatops_deployer/template.rb', line 18 def write(output_file_path) File.open(output_file_path, 'w') do |f| f.write(@erb.result(binding)) end end |