Class: SharedInfrastructure::Output
- Inherits:
-
File
- Object
- File
- SharedInfrastructure::Output
- Defined in:
- lib/shared_infrastructure/output.rb
Class Attribute Summary collapse
-
.root ⇒ Object
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_name, *args) ⇒ Output
constructor
A new instance of Output.
Constructor Details
#initialize(file_name, *args) ⇒ Output
Returns a new instance of Output.
18 19 20 |
# File 'lib/shared_infrastructure/output.rb', line 18 def initialize(file_name, *args) super Output.file_name(file_name), *args end |
Class Attribute Details
.root ⇒ Object
Returns the value of attribute root.
48 49 50 |
# File 'lib/shared_infrastructure/output.rb', line 48 def root @root end |
Class Method Details
.fake_root(root = nil) ⇒ Object
Fake root. If block is given, change the root only for the duration of the block. If no block is given, is the same as configure.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/shared_infrastructure/output.rb', line 26 def fake_root(root = nil) if block_given? begin save_root = Output.root fake_root(root) result = yield ensure fake_root(save_root) result end else self.root = root end end |
.file_name(file_name) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/shared_infrastructure/output.rb', line 41 def file_name(file_name) return file_name unless Output.root file_name = File.join(Output.root, file_name) FileUtils.mkdir_p(File.dirname(file_name)) file_name end |