Class: Rake::Scope
- Inherits:
-
LinkedList
- Object
- LinkedList
- Rake::Scope
- Defined in:
- lib/rake/scope.rb
Overview
:nodoc: all
Defined Under Namespace
Classes: EmptyScope
Constant Summary collapse
- EMPTY =
Singleton null object for an empty scope.
EmptyScope.new
Instance Attribute Summary
Attributes inherited from LinkedList
Instance Method Summary collapse
-
#path ⇒ Object
Path for the scope.
-
#path_with_task_name(task_name) ⇒ Object
Path for the scope + the named path.
-
#trim(n) ⇒ Object
Trim
n
innermost scope levels from the scope.
Methods inherited from LinkedList
#==, #conj, cons, #each, empty, #empty?, #inspect, make, #to_s
Instance Method Details
#path ⇒ Object
Path for the scope.
6 7 8 |
# File 'lib/rake/scope.rb', line 6 def path map(&:to_s).reverse.join(":") end |
#path_with_task_name(task_name) ⇒ Object
Path for the scope + the named path.
11 12 13 |
# File 'lib/rake/scope.rb', line 11 def path_with_task_name(task_name) "#{path}:#{task_name}" end |
#trim(n) ⇒ Object
Trim n
innermost scope levels from the scope. In no case will this trim beyond the toplevel scope.
17 18 19 20 21 22 23 24 |
# File 'lib/rake/scope.rb', line 17 def trim(n) result = self while n > 0 && !result.empty? result = result.tail n -= 1 end result end |