-
Notifications
You must be signed in to change notification settings - Fork 0
Ruby
ed-mare edited this page Feb 1, 2019
·
3 revisions
Get rid of the tiresome constant warnings. From https://stackoverflow.com/questions/3375360/how-to-redefine-a-ruby-constant-without-warning#3377188
module Constants
def self.define(const, value)
self.class.const_set(const, value) unless self.class.const_defined?(const)
end
def self.redefine(const, value)
self.class.send(:remove_const, const) if self.class.const_defined?(const)
self.class.const_set(const, value)
end
end- Ways to pass args: https://cobwwweb.com/4-ways-to-pass-arguments-to-a-rake-task (ENV vars and OptionsParser are the most readable).