Class: Heidi::Build::Logs
- Inherits:
-
Object
- Object
- Heidi::Build::Logs
- Defined in:
- lib/heidi/build.rb
Defined Under Namespace
Classes: Log
Instance Method Summary collapse
- #[](key) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(log_root) ⇒ Logs
constructor
A new instance of Logs.
Constructor Details
#initialize(log_root) ⇒ Logs
Returns a new instance of Logs.
169 170 171 172 173 174 175 176 |
# File 'lib/heidi/build.rb', line 169 def initialize(log_root) @log_root = log_root @logs = [] Dir[File.join(@log_root, "*")].each do |file| @logs << Log.new(file) end end |
Instance Method Details
#[](key) ⇒ Object
178 179 180 181 182 183 184 185 |
# File 'lib/heidi/build.rb', line 178 def [](key) log = @logs.select { |log| log.file_name == "#{key}" }.first if log.nil? @logs << ( log = Log.new( File.join(@log_root, "#{key}") ) ) end return log end |
#each(&block) ⇒ Object
187 188 189 190 |
# File 'lib/heidi/build.rb', line 187 def each(&block) heidi = @logs.select { |l| l.file_name =~ /heidi/ } (heidi + (@logs - heidi)).each(&block) end |