Class: NoteCreator

Inherits:
Object
  • Object
show all
Includes:
Modules::ResourceUtils
Defined in:
lib/notes_cli/services/note_creator.rb

Instance Method Summary collapse

Methods included from Modules::ResourceUtils

#config, #create?, #current_workspace, #notebook_exists?, #notebook_path, #notes_folder, #workspace_exists?, #workspace_path

Constructor Details

#initialize(notebook, title, notebook_path, workspace_path) ⇒ NoteCreator

Returns a new instance of NoteCreator.



6
7
8
9
10
11
# File 'lib/notes_cli/services/note_creator.rb', line 6

def initialize(notebook, title, notebook_path, workspace_path)
  @notebook = notebook
  @title = title.join('_')
  @notebook_path = notebook_path
  @workspace_path = workspace_path
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'lib/notes_cli/services/note_creator.rb', line 13

def call
  return unless notebook_exists?(@notebook) || create?('notebook')

  handle_errors
  create_note
  notify
end