Understanding namespaces in Ruby -
in code below:
::trace.tracer = ::trace::zipkintracer.new()
what relation between trace
, zipkintracer
?
zipkintracer
within of trace
namespace, this:
module trace class zipkintracer # ... end end
the ::
before constant name means point root. illustration in next code:
class class1 end module module1 class class1 end def foo ::class1 end end
::class1
ensures refer "root" class1
. if had:
def foo class1 end
the module1::class1
referred.
ruby
No comments:
Post a Comment