Class: Crusoe::Commands::Journal
- Inherits:
-
Object
- Object
- Crusoe::Commands::Journal
- Defined in:
- lib/crusoe/commands/journal.rb
Instance Attribute Summary collapse
-
#default_file_content ⇒ Object
readonly
Returns the value of attribute default_file_content.
-
#entry_file_name ⇒ Object
readonly
Returns the value of attribute entry_file_name.
Instance Method Summary collapse
-
#initialize(directory:, date: Date.today) ⇒ Journal
constructor
A new instance of Journal.
- #prepare_entry_file! ⇒ Object
Constructor Details
#initialize(directory:, date: Date.today) ⇒ Journal
Returns a new instance of Journal.
11 12 13 14 15 |
# File 'lib/crusoe/commands/journal.rb', line 11 def initialize(directory:, date: Date.today) entry = Crusoe::Entry.new(date) @entry_file_name = EntryFileName.new(entry, directory).to_s @default_file_content = EntryTemplate.new(entry).to_s end |
Instance Attribute Details
#default_file_content ⇒ Object (readonly)
Returns the value of attribute default_file_content.
9 10 11 |
# File 'lib/crusoe/commands/journal.rb', line 9 def default_file_content @default_file_content end |
#entry_file_name ⇒ Object (readonly)
Returns the value of attribute entry_file_name.
8 9 10 |
# File 'lib/crusoe/commands/journal.rb', line 8 def entry_file_name @entry_file_name end |
Instance Method Details
#prepare_entry_file! ⇒ Object
17 18 19 |
# File 'lib/crusoe/commands/journal.rb', line 17 def prepare_entry_file! EntryFile.create_unless_exist(entry_file_name, default_file_content) end |