Module: Bioroebe::InferTheNamespaceModule
Overview
Bioroebe::InferTheNamespaceModule
Instance Method Summary
collapse
Instance Method Details
#infer_the_namespace ⇒ Object
#
infer_the_namespace
This will assume the true namespace from the inspectable name.
#
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/bioroebe/base/infer_the_namespace_module/infer_the_namespace_module.rb', line 24
def infer_the_namespace
_ = inspect.to_s.delete('<')
_ = _.split(':0').first if _.include?(':0')
if _.include? ' '
_ = _.split(' ').first.delete('#')
if _.include? ':'
_ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::')
end
end
_.delete!('#') if _.include?('#')
@namespace = _ end
|
#namespace? ⇒ Boolean
15
16
17
|
# File 'lib/bioroebe/base/infer_the_namespace_module/infer_the_namespace_module.rb', line 15
def namespace?
@namespace
end
|