Class: Dotenv::EnvTemplate
- Inherits:
-
Object
- Object
- Dotenv::EnvTemplate
- Defined in:
- lib/dotenv/template.rb
Overview
Class for creating a template from a env file
Instance Method Summary collapse
- #create_template ⇒ Object
-
#initialize(env_file) ⇒ EnvTemplate
constructor
A new instance of EnvTemplate.
Constructor Details
#initialize(env_file) ⇒ EnvTemplate
Returns a new instance of EnvTemplate.
4 5 6 |
# File 'lib/dotenv/template.rb', line 4 def initialize(env_file) @env_file = env_file end |
Instance Method Details
#create_template ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dotenv/template.rb', line 8 def create_template File.open(@env_file, "r") do |env_file| File.open("#{@env_file}.template", "w") do |env_template| env_file.each do |line| variable = line.split("=").first env_template.puts "#{variable}=#{variable}" end end end end |