/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

  1. module Rake
  2. # The NameSpace class will lookup task names in the the scope
  3. # defined by a +namespace+ command.
  4. #
  5. class NameSpace
  6. # Create a namespace lookup object using the given task manager
  7. # and the list of scopes.
  8. def initialize(task_manager, scope_list)
  9. @task_manager = task_manager
  10. @scope = scope_list.dup
  11. end
  12. # Lookup a task named +name+ in the namespace.
  13. def [](name)
  14. @task_manager.lookup(name, @scope)
  15. end
  16. # Return the list of tasks defined in this and nested namespaces.
  17. def tasks
  18. @task_manager.tasks_in_scope(@scope)
  19. end
  20. end
  21. end