Sha256: cda75e6aa9f9be40eacda9be9767dba79c4ccf77a62a0f048bf8a31aeb81d925

Contents?: true

Size: 465 Bytes

Versions: 3

Compression:

Stored size: 465 Bytes

Contents

# encoding: utf-8
module Filegen
  # Data Sources
  module DataSources
    # Data source which makes environment variables available
    class Environment
      private

      attr_reader :source

      public

      # Create data source
      def initialize
        @source = HashWithIndifferentAccess.new(ENV.to_hash)
      end

      def fetch(key, default_value = nil)
        source[key.to_sym] || source[key.to_s] || default_value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
filegen-0.4.3 lib/filegen/data_sources/environment.rb
filegen-0.4.1 lib/filegen/data_sources/environment.rb
filegen-0.4.0 lib/filegen/data_sources/environment.rb