Class: EnvManager::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/env_manager/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_contents) ⇒ Builder

Returns a new instance of Builder.



5
6
7
# File 'lib/env_manager/builder.rb', line 5

def initialize(file_contents)
  build(file_contents)
end

Instance Method Details

#build(file_contents) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/env_manager/builder.rb', line 9

def build(file_contents)
  hash = dynamic_assignment(file_contents)
  hash.each do |key, value|
    instance_variable_set("@#{key}", value)
    self.class.send(:attr_accessor, key)
  end
end

#envObject



23
24
25
# File 'lib/env_manager/builder.rb', line 23

def env
  ::ENV['RACK_ENV']
end