Class: Evertils::Controller::Log

Inherits:
Base
  • Object
show all
Defined in:
lib/evertils/controllers/log.rb

Constant Summary

Constants inherited from Base

Base::OK, Base::QUIT, Base::QUIT_SOFT

Instance Attribute Summary

Attributes inherited from Base

#config, #request

Instance Method Summary collapse

Methods inherited from Base

#can_exec?, #exec, #initialize, #post_exec, #sample

Constructor Details

This class inherits a constructor from Evertils::Controller::Base

Instance Method Details

#grep(text = nil) ⇒ Object

Since:

  • 2.2.0



25
26
27
28
29
30
31
32
33
# File 'lib/evertils/controllers/log.rb', line 25

def grep(text = nil)
  return Notify.error('A search term is required') if text.nil?

  @note = @note_helper.find_note_by_grammar(grammar.to_s)

  return Notify.error('Note not found') if @note.entity.nil?

  search_for(text)
end

#group(text = nil) ⇒ Object

Since:

  • 2.2.0



37
38
39
40
41
42
43
# File 'lib/evertils/controllers/log.rb', line 37

def group(text = nil)
  @note = @note_helper.find_note_by_grammar(grammar.to_s)

  return Notify.error('Note not found') if @note.entity.nil?

  group_by(text)
end

#message(text = nil) ⇒ Object

Send arbitrary text to the daily log



13
14
15
16
17
18
19
20
21
# File 'lib/evertils/controllers/log.rb', line 13

def message(text = nil)
  return Notify.error('A message is required') if text.nil?

  @note = @note_helper.find_note_by_grammar(grammar.to_s)

  return Notify.error('Note not found') if @note.entity.nil?

  modify_with(text)
end

#pre_execObject



4
5
6
7
8
9
10
# File 'lib/evertils/controllers/log.rb', line 4

def pre_exec
  super

  @note = nil
  @note_helper = Evertils::Helper::Note.instance
  @api_helper = Evertils::Helper::ApiEnmlHandler.new(@config)
end