Module: MPS

Defined in:
lib/mps.rb,
lib/cli/mps.rb,
lib/mps/mps.rb,
lib/mps/query.rb,
lib/mps/store.rb,
lib/mps/config.rb,
lib/mps/version.rb,
lib/mps/constants.rb,
lib/mps/presenter.rb,
lib/mps/engines/mps.rb,
lib/mps/elements/log.rb,
lib/mps/elements/mps.rb,
lib/mps/ref_resolver.rb,
lib/mps/elements/note.rb,
lib/mps/elements/task.rb,
lib/mps/elements/element.rb,
lib/mps/elements/reminder.rb,
lib/mps/interpolators/time.rb

Defined Under Namespace

Modules: CLI, Constants, Element, Elements, Engines, Interpolators Classes: Config, Error, Presenter, Query, RefResolver, Store

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.get_date(str) ⇒ Object



4
5
6
# File 'lib/mps/mps.rb', line 4

def self.get_date(str)
  Chronic.parse(str).to_date
end

.get_filename_from_date(date) ⇒ Object



8
9
10
# File 'lib/mps/mps.rb', line 8

def self.get_filename_from_date(date)
  Constants::MPS_NEW_FILE_NAME_GEN.call(date)
end

.get_filenames_from_date_range(s_date, e_date) ⇒ Object



12
13
14
# File 'lib/mps/mps.rb', line 12

def self.get_filenames_from_date_range(s_date, e_date)
  (s_date..e_date).collect { |date| MPS.get_filename_from_date(date) }
end

.open_editor(text_file) ⇒ Object



16
17
18
19
20
21
# File 'lib/mps/mps.rb', line 16

def self.open_editor(text_file)
  init_size = File.exist?(text_file) ? File.size(text_file) : 0
  TTY::Editor.open(text_file, command: "vim")
  curr_size = File.exist?(text_file) ? File.size(text_file) : 0
  curr_size - init_size
end