Class: Heidi::Build::Logs::Log
- Inherits:
-
Object
- Object
- Heidi::Build::Logs::Log
- Defined in:
- lib/heidi/build.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Instance Method Summary collapse
-
#initialize(file) ⇒ Log
constructor
A new instance of Log.
- #raw(msg) ⇒ Object
- #write(msg, fmt = true) ⇒ Object
Constructor Details
#initialize(file) ⇒ Log
Returns a new instance of Log.
194 195 196 197 198 |
# File 'lib/heidi/build.rb', line 194 def initialize(file) @file = file @file_name = File.basename(file) @contents = File.read(file) rescue "" end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
193 194 195 |
# File 'lib/heidi/build.rb', line 193 def contents @contents end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
193 194 195 |
# File 'lib/heidi/build.rb', line 193 def file_name @file_name end |
Instance Method Details
#raw(msg) ⇒ Object
210 211 212 |
# File 'lib/heidi/build.rb', line 210 def raw(msg) write(msg, false) end |
#write(msg, fmt = true) ⇒ Object
200 201 202 203 204 205 206 207 208 |
# File 'lib/heidi/build.rb', line 200 def write(msg,fmt=true) File.open(@file, File::CREAT|File::APPEND|File::WRONLY) do |f| if fmt == true f.puts "%s\t%s" % [ Time.now.strftime("%c"), msg ] else f.puts msg end end end |