lib/usable.rb in usable-3.4.0 vs lib/usable.rb in usable-3.5.0
- old
+ new
@@ -4,10 +4,15 @@
require 'usable/version'
require 'usable/mod_extender'
require 'usable/config'
module Usable
+ # Keep track of extended classes and modules so we can freeze all usables on boot in production environments
+ def self.extended_constants
+ @extended_constants ||= Set.new
+ end
+
def self.extended(base)
if base.is_a? Class
# Define an instance level version of +usables+
base.class_eval do
def usables
@@ -29,9 +34,10 @@
usables
end
end
end
end
+ extended_constants << base
end
def usables
@usables ||= Config.new
end