mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
PERF: remove eval cause it is costing lots of memory
see: http://tenderlovemaking.com/2013/03/03/dynamic_method_definitions.html isolated via memory profiler gem.
This commit is contained in:
parent
3c6aede1aa
commit
ab3d4471fe
1 changed files with 5 additions and 6 deletions
|
@ -394,7 +394,7 @@ module SiteSettingExtension
|
|||
def setup_methods(name)
|
||||
clean_name = name.to_s.sub("?", "")
|
||||
|
||||
eval "define_singleton_method :#{clean_name} do
|
||||
define_singleton_method clean_name do
|
||||
c = @containers[provider.current_site]
|
||||
if c
|
||||
c[name]
|
||||
|
@ -404,14 +404,13 @@ module SiteSettingExtension
|
|||
end
|
||||
end
|
||||
|
||||
define_singleton_method :#{clean_name}? do
|
||||
#{clean_name}
|
||||
define_singleton_method clean_name + "?" do
|
||||
clean_name
|
||||
end
|
||||
|
||||
define_singleton_method :#{clean_name}= do |val|
|
||||
add_override!(:#{name}, val)
|
||||
define_singleton_method clean_name + "=" do |val|
|
||||
add_override!(name, val)
|
||||
end
|
||||
"
|
||||
end
|
||||
|
||||
def enum_class(name)
|
||||
|
|
Loading…
Reference in a new issue