jasonkarns
3/8/2016 - 12:43 AM

Deserialize YAML config file into a singleton instance

Deserialize YAML config file into a singleton instance

require 'singleton'

class Configuration
  include Singleton

  def init_with(attributes)
    attributes.map.each do |k,v|
      self.class.instance.instance_variable_set(:"@#{k}", v)
    end
  end
  public_class_method :allocate

end