module Her::Model::Introspection::ClassMethods
@private
Public Instance Methods
her_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/castle-her/model/introspection.rb, line 40 def her_nearby_class(name) her_sibling_class(name) || name.constantize rescue nil end
Protected Instance Methods
her_containing_module()
click to toggle source
If available, returns the containing Module for this class.
@private
# File lib/castle-her/model/introspection.rb, line 58 def her_containing_module return unless self.name =~ /::/ self.name.split("::")[0..-2].join("::").constantize end
her_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/castle-her/model/introspection.rb, line 48 def her_sibling_class(name) if mod = self.her_containing_module @_her_sibling_class ||= Hash.new { Hash.new } @_her_sibling_class[mod][name] ||= "#{mod.name}::#{name}".constantize rescue nil end end