Class: Wloger::Command

Inherits:
Thor
  • Object
show all
Defined in:
lib/wloger/command.rb

Overview

Command line parse class

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/wloger/command.rb', line 32

def method_missing(method)
  begin
    date = Date.parse(method.to_s.rjust(2, '0'))
  rescue ArgumentError
    return help
  end

  @past_log = Wloger::PastLogFile.new(date)
  @past_log.view
end

Instance Method Details

#search(key) ⇒ Object



18
19
20
21
22
23
# File 'lib/wloger/command.rb', line 18

def search(key)
  dates = find_all_log_dates
  grep_results = get_all_grep_results(dates, key)

  Wloger::Interface::Search.new(grep_results)
end

#today_logObject



11
12
13
14
15
# File 'lib/wloger/command.rb', line 11

def today_log
  date = Date.today
  @today_log = Wloger::TodayLogFile.new(date)
  @today_log.edit
end

#versionObject



26
27
28
# File 'lib/wloger/command.rb', line 26

def version
  puts Wloger::VERSION
end