PageRenderTime 41ms CodeModel.GetById 37ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/name_space.rb

http://github.com/agross/netopenspace
Ruby | 25 lines | 14 code | 4 blank | 7 comment | 0 complexity | ac2bc7cf70e859e987c07f03c43209a9 MD5 | raw file
 1module Rake
 2
 3  # The NameSpace class will lookup task names in the the scope
 4  # defined by a +namespace+ command.
 5  #
 6  class NameSpace
 7
 8    # Create a namespace lookup object using the given task manager
 9    # and the list of scopes.
10    def initialize(task_manager, scope_list)
11      @task_manager = task_manager
12      @scope = scope_list.dup
13    end
14
15    # Lookup a task named +name+ in the namespace.
16    def [](name)
17      @task_manager.lookup(name, @scope)
18    end
19
20    # Return the list of tasks defined in this and nested namespaces.
21    def tasks
22      @task_manager.tasks_in_scope(@scope)
23    end
24  end
25end