Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cache results of sibling_class, and remove duplicated name.constantize

  • Loading branch information...
commit e1f5782c585c3f8a8a3f96b0fb48d87de260aab5 1 parent 18ce87d
@thomsbg thomsbg authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/her/model/introspection.rb
View
6 lib/her/model/introspection.rb
@@ -39,9 +39,9 @@ def nearby_class(name) # {{{
# @private
def sibling_class(name) # {{{
if mod = self.containing_module
- "#{mod.name}::#{name}".constantize rescue nil
- else
- name.constantize rescue nil
+ @sibling_class ||= {}
+ @sibling_class[mod] ||= {}
+ @sibling_class[mod][name] ||= "#{mod.name}::#{name}".constantize rescue nil
end
end # }}}
Please sign in to comment.
Something went wrong with that request. Please try again.