Class: StreamdeckProf::LazyFile
- Inherits:
-
Object
- Object
- StreamdeckProf::LazyFile
- Defined in:
- lib/streamdeck_prof/lazy_file.rb
Instance Attribute Summary collapse
-
#source_path ⇒ Object
Returns the value of attribute source_path.
Instance Method Summary collapse
-
#initialize(source_path) ⇒ LazyFile
constructor
A new instance of LazyFile.
- #save(path) ⇒ Object
Constructor Details
#initialize(source_path) ⇒ LazyFile
Returns a new instance of LazyFile.
9 10 11 |
# File 'lib/streamdeck_prof/lazy_file.rb', line 9 def initialize(source_path) @source_path = source_path end |
Instance Attribute Details
#source_path ⇒ Object
Returns the value of attribute source_path.
7 8 9 |
# File 'lib/streamdeck_prof/lazy_file.rb', line 7 def source_path @source_path end |
Instance Method Details
#save(path) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/streamdeck_prof/lazy_file.rb', line 13 def save(path) file_dir = File.dirname(path) FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir) FileUtils.copy(source_path, path) unless File.realdirpath(path) == File.realdirpath(source_path) end |