Class: Basketcase::TargetList
- Inherits:
-
Object
- Object
- Basketcase::TargetList
- Includes:
- Utils, Enumerable
- Defined in:
- lib/basketcase.rb
Instance Method Summary collapse
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(targets) ⇒ TargetList
constructor
A new instance of TargetList.
- #parents ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
Methods included from Utils
Constructor Details
#initialize(targets) ⇒ TargetList
Returns a new instance of TargetList.
130 131 132 |
# File 'lib/basketcase.rb', line 130 def initialize(targets) @target_paths = targets.map { |t| mkpath(t) } end |
Instance Method Details
#each ⇒ Object
134 135 136 137 138 |
# File 'lib/basketcase.rb', line 134 def each @target_paths.each do |t| yield(t) end end |
#empty? ⇒ Boolean
144 145 146 |
# File 'lib/basketcase.rb', line 144 def empty? @target_paths.empty? end |
#parents ⇒ Object
152 153 154 |
# File 'lib/basketcase.rb', line 152 def parents TargetList.new(@target_paths.map { |t| t.parent }.uniq) end |
#size ⇒ Object
148 149 150 |
# File 'lib/basketcase.rb', line 148 def size @target_paths.size end |
#to_s ⇒ Object
140 141 142 |
# File 'lib/basketcase.rb', line 140 def to_s @target_paths.map { |f| "'#{f}'" }.join(" ") end |