Module: MPS

Defined in:
lib/mps.rb,
lib/cli/mps.rb,
lib/mps/mps.rb,
lib/mps/store.rb,
lib/mps/config.rb,
lib/mps/version.rb,
lib/mps/constants.rb,
lib/mps/engines/mps.rb,
lib/mps/elements/log.rb,
lib/mps/elements/mps.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, Store

Constant Summary collapse

VERSION =
"0.5.0"

Class Method Summary collapse

Class Method Details

.get_date(str) ⇒ Object



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

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

.get_filename_from_date(date) ⇒ Object



15
16
17
# File 'lib/mps/mps.rb', line 15

def self.get_filename_from_date(date)
  "#{date.strftime('%Y%m%d')}.#{Constants::MPS_EXT}"
end

.get_filenames_from_date_range(s_date, e_date) ⇒ Object



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

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

.open_editor(text_file) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/mps/mps.rb', line 23

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