Sha256: 001f45bf9ea383dcc653f78c735c31f47ae8090852537aa1c89772e2be3cca6b
Contents?: true
Size: 568 Bytes
Versions: 2
Compression:
Stored size: 568 Bytes
Contents
module ZenGarden class EnvFile attr_reader :location def initialize location=".env" @location = location raise ArgumentError, "Env file not found" unless exists? end def exports contents.select { |line| line =~ /\Aexport\s/ } .map { |line| line.gsub(/\Aexport\s/, '').split '=' } .reduce({}) { |hash,(key,value)| hash.merge key => value } end def contents @contents ||= File.read(location).split "\n" end private def exists? File.exists? location end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zen_garden-0.0.6 | lib/zen_garden/env_file.rb |
zen_garden-0.0.5 | lib/zen_garden/env_file.rb |