Skip to content

Instantly share code, notes, and snippets.

@pupca
Created June 2, 2011 10:03
Show Gist options
  • Save pupca/1004200 to your computer and use it in GitHub Desktop.
Save pupca/1004200 to your computer and use it in GitHub Desktop.
@@available_settings = YAML::load(File.open("#{RAILS_ROOT}/config/settings.yml"))
@@available_settings.each do |name, params|
src = <<-END_SRC
def self.#{name}
self[:#{name}]
end
def self.#{name}?
self[:#{name}].to_i > 0
end
def self.#{name}=(value)
self[:#{name}] = value
end
END_SRC
Seeting.class_eval src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment