Class: Basketcase::TargetList

Inherits:
Object
  • Object
show all
Includes:
Utils, Enumerable
Defined in:
lib/basketcase.rb

Instance Method Summary collapse

Methods included from Utils

#mkpath

Constructor Details

#initialize(targets) ⇒ TargetList

Returns a new instance of TargetList.



116
117
118
# File 'lib/basketcase.rb', line 116

def initialize(targets)
  @target_paths = targets.map { |t| mkpath(t) }
end

Instance Method Details

#eachObject



120
121
122
123
124
# File 'lib/basketcase.rb', line 120

def each
  @target_paths.each do |t|
    yield(t)
  end
end

#empty?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/basketcase.rb', line 130

def empty?
  @target_paths.empty?
end

#parentsObject



138
139
140
# File 'lib/basketcase.rb', line 138

def parents
  TargetList.new(@target_paths.map { |t| t.parent }.uniq)
end

#sizeObject



134
135
136
# File 'lib/basketcase.rb', line 134

def size
  @target_paths.size
end

#to_sObject



126
127
128
# File 'lib/basketcase.rb', line 126

def to_s
  @target_paths.map { |f| "\"#{f}\"" }.join(" ")
end