Class: GitTest::Writer
- Inherits:
-
Object
- Object
- GitTest::Writer
- Defined in:
- lib/git_test/writer.rb
Overview
takes a path, a name (file name) and a report makes directory if not present writes the given report to the file name in that path
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#notify ⇒ Object
Returns the value of attribute notify.
-
#path ⇒ Object
Returns the value of attribute path.
-
#report ⇒ Object
Returns the value of attribute report.
Class Method Summary collapse
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(options, notify = Notify.new) ⇒ Writer
constructor
A new instance of Writer.
- #mkdir! ⇒ Object
- #save ⇒ Object (also: #save!)
- #show_report ⇒ Object
- #write_report_to_disk! ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/git_test/writer.rb', line 9 def name @name end |
#notify ⇒ Object
Returns the value of attribute notify.
9 10 11 |
# File 'lib/git_test/writer.rb', line 9 def notify @notify end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/git_test/writer.rb', line 9 def path @path end |
#report ⇒ Object
Returns the value of attribute report.
9 10 11 |
# File 'lib/git_test/writer.rb', line 9 def report @report end |
Class Method Details
.save(*args) ⇒ Object
32 33 34 |
# File 'lib/git_test/writer.rb', line 32 def self.save(*args) self.new(*args).save end |
Instance Method Details
#full_path ⇒ Object
23 24 25 |
# File 'lib/git_test/writer.rb', line 23 def full_path File.join(path, name) end |
#mkdir! ⇒ Object
19 20 21 |
# File 'lib/git_test/writer.rb', line 19 def mkdir! FileUtils.mkdir_p(path) end |
#save ⇒ Object Also known as: save!
36 37 38 39 |
# File 'lib/git_test/writer.rb', line 36 def save notify.start("Writing report to #{full_path}") write_report_to_disk! end |
#show_report ⇒ Object
42 43 44 |
# File 'lib/git_test/writer.rb', line 42 def show_report system "open #{}" end |
#write_report_to_disk! ⇒ Object
27 28 29 30 |
# File 'lib/git_test/writer.rb', line 27 def write_report_to_disk! mkdir! File.open(full_path, 'w') {|f| f.write(report) } end |