Method: BBLib::SimpleInit::ClassMethods#parent_namespace

Defined in:
lib/bblib/core/mixins/simple_init.rb

#parent_namespaceObject

Returns the nearest parent namespace to thi current class. Object is returned if this class is not in a namespace.



165
166
167
168
169
170
171
172
# File 'lib/bblib/core/mixins/simple_init.rb', line 165

def parent_namespace
  parent = self.to_s.split('::')[0..-2].join('::')
  if parent.empty?
    return Object
  else
    Object.const_get(parent)
  end
end