Class: Evertils::Controller::Log
- Defined in:
- lib/evertils/controllers/log.rb
Constant Summary collapse
- WORDS_PER_LINE =
20
Constants inherited from Base
Base::OK, Base::QUIT, Base::QUIT_SOFT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #grep(text = nil) ⇒ Object
- #group ⇒ Object
-
#message(text = nil) ⇒ Object
Send arbitrary text to the daily log.
- #pre_exec ⇒ Object
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
34 35 36 37 38 39 40 |
# File 'lib/evertils/controllers/log.rb', line 34 def grep(text = nil) params = OpenStruct.new(term: text, action: 'search', notebook: 'Daily') runner = ActionRunner.new runner.params = params runner.execute end |
#group ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/evertils/controllers/log.rb', line 44 def group params = OpenStruct.new(action: 'group', notebook: 'Daily') runner = ActionRunner.new runner.params = params runner.execute end |
#message(text = nil) ⇒ Object
Send arbitrary text to the daily log
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/evertils/controllers/log.rb', line 19 def (text = nil) return Notify.error('A message is required') if text.nil? @note = @note_helper.find_note_by_grammar(grammar.to_s) text_groups = text.split(' ').each_slice(WORDS_PER_LINE).map do |w| w.join(' ') end return Notify.error('Note not found') if @note.entity.nil? modify_with(text_groups) end |