Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.