Class: Tomify::Constantly
- Inherits:
-
Object
- Object
- Tomify::Constantly
- Defined in:
- lib/tomify/constantly.rb
Instance Method Summary collapse
-
#initialize(methods) ⇒ Constantly
constructor
A new instance of Constantly.
Constructor Details
#initialize(methods) ⇒ Constantly
Returns a new instance of Constantly.
3 4 5 6 7 8 9 10 |
# File 'lib/tomify/constantly.rb', line 3 def initialize(methods) methods.each do |key, value| define_singleton_method(key) { value.constantize } define_singleton_method("#{key}=") do |new_value| define_singleton_method(key) { new_value.constantize } end end end |