Skip to content

Instantly share code, notes, and snippets.

@sathlan
Created January 17, 2013 18:47
Show Gist options
  • Save sathlan/4558491 to your computer and use it in GitHub Desktop.
Save sathlan/4558491 to your computer and use it in GitHub Desktop.
eigenclass example.

module Greeter class Configurator OPTIONS = { :name => ‘toto’, :verbose => false, }

class << self OPTIONS.each do |name, default| define_method(name) do instance_variable_get(“@#{name}”) || default end define_method(“#{name}=”) do |value| instance_variable_set(“@#{name}”, value) end end end

end Config = Configurator end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment