Class: Kuromd::Journal::Inbox
- Inherits:
-
Object
- Object
- Kuromd::Journal::Inbox
- Defined in:
- lib/kuromd/journal/inbox.rb
Overview
represents an Inbox folder
Instance Method Summary collapse
-
#create ⇒ Object
creates the inbox folder (if it isn’t created).
-
#initialize(inbox_path:) ⇒ Inbox
constructor
A new instance of Inbox.
-
#ls ⇒ Object
list files in the inbox folder.
- #save(filename:, journal_date: Date.today) ⇒ Object
Constructor Details
Instance Method Details
#create ⇒ Object
creates the inbox folder (if it isn’t created)
17 18 19 20 |
# File 'lib/kuromd/journal/inbox.rb', line 17 def create FileUtils.mkdir_p @inbox_fullpath if @created == false @created = true end |
#ls ⇒ Object
list files in the inbox folder
23 24 25 |
# File 'lib/kuromd/journal/inbox.rb', line 23 def ls Dir[@inbox_fullpath] end |
#save(filename:, journal_date: Date.today) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/kuromd/journal/inbox.rb', line 27 def save(filename:, journal_date: Date.today) _filename = File.(filename) _basename = File.basename _filename inbox_filename = "#{journal_date} - #{_basename}" dest_file = File.join(@inbox_fullpath, inbox_filename) FileUtils.mv _filename, dest_file end |