Class: Cure::Configuration::FileContentsHandler
- Inherits:
-
DefaultFileHandler
- Object
- DefaultFileHandler
- Cure::Configuration::FileContentsHandler
- Defined in:
- lib/cure/config.rb
Instance Attribute Summary collapse
Attributes inherited from DefaultFileHandler
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(file_contents, ref_name) ⇒ FileContentsHandler
constructor
A new instance of FileContentsHandler.
- #with_file(&_block) ⇒ Object
Constructor Details
#initialize(file_contents, ref_name) ⇒ FileContentsHandler
Returns a new instance of FileContentsHandler.
173 174 175 176 |
# File 'lib/cure/config.rb', line 173 def initialize(file_contents, ref_name) super(:file_contents, ref_name) @file_contents = file_contents end |
Instance Attribute Details
#file_contents ⇒ String
170 171 172 |
# File 'lib/cure/config.rb', line 170 def file_contents @file_contents end |
Instance Method Details
#description ⇒ Object
189 190 191 |
# File 'lib/cure/config.rb', line 189 def description "<content provided>" end |
#with_file(&_block) ⇒ Object
178 179 180 181 182 183 184 185 186 187 |
# File 'lib/cure/config.rb', line 178 def with_file(&_block) tmp_file = Tempfile.new('cure-temp') tmp_file.write(@file_contents) tmp_file.open yield tmp_file, @ref_name ensure tmp_file.unlink end |