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.



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

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

Instance Method Details

#eachObject



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

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

#empty?Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/basketcase.rb', line 144

def empty?
  @target_paths.empty?
end

#parentsObject



152
153
154
# File 'lib/basketcase.rb', line 152

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

#sizeObject



148
149
150
# File 'lib/basketcase.rb', line 148

def size
  @target_paths.size
end

#to_sObject



140
141
142
# File 'lib/basketcase.rb', line 140

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