Class: StreamdeckProf::FileList
- Inherits:
-
Object
- Object
- StreamdeckProf::FileList
- Defined in:
- lib/streamdeck_prof/file_list.rb
Instance Method Summary collapse
- #[](path) ⇒ Object
- #[]=(path, file) ⇒ Object
-
#initialize ⇒ FileList
constructor
A new instance of FileList.
- #save(storage_path) ⇒ Object
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize ⇒ FileList
Returns a new instance of FileList.
5 6 7 |
# File 'lib/streamdeck_prof/file_list.rb', line 5 def initialize @files = {} end |
Instance Method Details
#[](path) ⇒ Object
9 10 11 |
# File 'lib/streamdeck_prof/file_list.rb', line 9 def [](path) @files[path] end |
#[]=(path, file) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/streamdeck_prof/file_list.rb', line 13 def []=(path, file) if file.nil? @files.delete(path) else @files[path] = file end end |
#save(storage_path) ⇒ Object
27 28 29 |
# File 'lib/streamdeck_prof/file_list.rb', line 27 def save(storage_path) @files.each { |path, file| file.save(File.join(storage_path, path)) } end |
#to_hash ⇒ Object Also known as: to_h
21 22 23 |
# File 'lib/streamdeck_prof/file_list.rb', line 21 def to_hash @files end |