Class: Worque::Command::Todo::Action
- Inherits:
-
Object
- Object
- Worque::Command::Todo::Action
- Defined in:
- lib/worque/command/todo/action.rb
Constant Summary collapse
- FILE_PATH_FORMAT =
"%<path>s/notes-%<date>s.md".freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(options) ⇒ Action
Returns a new instance of Action.
11 12 13 14 |
# File 'lib/worque/command/todo/action.rb', line 11 def initialize() @options = end |
Class Method Details
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/worque/command/todo/action.rb', line 16 def call Worque::Utils::Command.mkdir(.path) notes_file_path = filename(date_for).tap do |f| Worque::Utils::Command.touch f end if .template_path && File.read(notes_file_path) == "" template = File.read(File.(.template_path)) Worque::Utils::Command.append_text(notes_file_path, template) end if .append_task Worque::Utils::Command.append_text(notes_file_path, .append_task) end notes_file_path end |