This file is indexed.

/usr/share/doc/libneedle-ruby1.8/doc/manual/parts/customizing_namespaces.txt is in libneedle-ruby1.8 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
By default, when you create a namespace in Needle, the namespace is registered as a service. The type of the service is determined by the @:namespace_impl_factory@ service, which (by default) returns the @Needle::Container@ class.

You can specify your own custom implementation for namespaces by registering your own @:namespace_impl_factory@ service. In fact, each namespace can have its own implementation of subnamespaces--just register a @:namespace_impl_factory@ in each one that you want to be specialized.

Here's a contrived example. Suppose you want each namespace to keep track of the precise time that it was created.

{{{lang=ruby,number=true,caption=Custom namespace implementations
class TimeTrackerNamespace < Needle::Container
  attr_reader :birth_date

  def initialize( *args )
    super
    @birth_date = Time.now
  end
end

reg = Needle::Registry.new
reg.register( :namespace_impl_factory ) { TimeTrackerNamespace }

reg.namespace :hello
p reg.hello.birth_date
}}}

In general, you'll be better off having your custom implementation extend @Needle::Container@, although the only _real_ requirement is that your implementation publish the same interface as the default namespace implementation.