Class: Evertils::Controller::Convert
- Defined in:
- lib/evertils/controllers/convert.rb
Constant Summary
Constants inherited from Base
Base::OK, Base::QUIT, Base::QUIT_SOFT
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#notebook ⇒ Object
Returns the value of attribute notebook.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Base
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 Attribute Details
#file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/evertils/controllers/convert.rb', line 4 def file @file end |
#notebook ⇒ Object
Returns the value of attribute notebook.
4 5 6 |
# File 'lib/evertils/controllers/convert.rb', line 4 def notebook @notebook end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/evertils/controllers/convert.rb', line 4 def title @title end |
Instance Method Details
#notes_in ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/evertils/controllers/convert.rb', line 27 def notes_in unless @notebook Notify.error("Notebook (--notebook=) is a required argument") end = @model.notes_by_notebook(@notebook) if .is_a? Hash Notify.info("#{.size} notes in #{@notebook}") Notify.info("Printing list of notes") .each_pair do |note_guid, note_content| # convert it here! Notify.spit(note_content) end else Notify.error("Could not pull data for notebook #{@notebook}") end end |
#pre_exec ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/evertils/controllers/convert.rb', line 6 def pre_exec # command flag parser OptionParser.new do |opt| opt. = "#{Evertils::PACKAGE_NAME} new note [...-flags]" opt.on("-m", "--to-markdown", "Convert to MD format") do |b| @markdown = b end opt.on("-e", "--to-enml", "Convert to ENML") do |b| @file = b end opt.on("-n", "--notebook=PBOOK", "Attach a file to your custom note") do |notebook| @notebook = notebook.capitalize end end.parse! super end |