module Her::Model::Introspection::ClassMethods
Public Instance Methods
nearby_class(name)
click to toggle source
Finds a class at the same level as this one or at the global level. @private
# File lib/her/model/introspection.rb, line 33 def nearby_class(name) sibling_class(name) || name.constantize rescue nil end
Protected Instance Methods
containing_module()
click to toggle source
If available, returns the containing Module for this class. @private
# File lib/her/model/introspection.rb, line 50 def containing_module return unless self.name =~ /::/ self.name.split("::")[0..-2].join("::").constantize end
sibling_class(name)
click to toggle source
Looks for a class at the same level as this one with the given name. @private
# File lib/her/model/introspection.rb, line 40 def sibling_class(name) if mod = self.containing_module @sibling_class ||= {} @sibling_class[mod] ||= {} @sibling_class[mod][name] ||= "#{mod.name}::#{name}".constantize rescue nil end end