Class: Rake::NameSpace

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/name_space.rb

Overview

The NameSpace class will lookup task names in the scope defined by a namespace command.

Instance Method Summary collapse

Constructor Details

#initialize(task_manager, scope_list) ⇒ NameSpace

Create a namespace lookup object using the given task manager and the list of scopes.



11
12
13
14
# File 'lib/rake/name_space.rb', line 11

def initialize(task_manager, scope_list)
  @task_manager = task_manager
  @scope = scope_list.dup
end

Instance Method Details

#[](name) ⇒ Object

Lookup a task named name in the namespace.



19
20
21
# File 'lib/rake/name_space.rb', line 19

def [](name)
  @task_manager.lookup(name, @scope)
end

#scopeObject

The scope of the namespace (a LinkedList)



26
27
28
# File 'lib/rake/name_space.rb', line 26

def scope
  @scope.dup
end

#tasksObject

Return the list of tasks defined in this and nested namespaces.



33
34
35
# File 'lib/rake/name_space.rb', line 33

def tasks
  @task_manager.tasks_in_scope(@scope)
end