Sha256: 599ded338e2809d982674f72b95963bd91a9617713b503d9930fcd2efdf29998

Contents?: true

Size: 611 Bytes

Versions: 6

Compression:

Stored size: 611 Bytes

Contents

class Isomer::Sources::Environment < Isomer::Sources::Base
  attr_reader :prefix

  def initialize(parameters, options={})
    @convert_case = options.has_key?(:convert_case) ? options[:convert_case] : true
    @prefix = options[:prefix]

    super(parameters)
  end

  def load
    @configuration = {}
    parameters.each do |parameter|
      @configuration[parameter.name] = ENV[ convert_name(parameter.name) ]
    end
  end

  def convert_case?
    @convert_case
  end

  private

  def convert_name(name)
    converted = [prefix, name].compact.join
    convert_case? ? converted.upcase : converted
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
isomer-0.1.4 lib/isomer/sources/environment.rb
isomer-0.1.3 lib/isomer/sources/environment.rb
isomer-0.1.2 lib/isomer/sources/environment.rb
isomer-0.1.1 lib/isomer/sources/environment.rb
isomer-0.1.0 lib/isomer/sources/environment.rb
isomer-0.0.1 lib/isomer/sources/environment.rb