Class: Plugins::EditPlugin
- Defined in:
- lib/bujo/plugins/edit_plugin.rb
Instance Attribute Summary
Attributes inherited from Plugin
Instance Method Summary collapse
- #edit_entry(relative_path) ⇒ Object
-
#initialize(dependencies = [], editor = nil) ⇒ EditPlugin
constructor
A new instance of EditPlugin.
Methods inherited from Plugin
Constructor Details
#initialize(dependencies = [], editor = nil) ⇒ EditPlugin
Returns a new instance of EditPlugin.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bujo/plugins/edit_plugin.rb', line 12 def initialize(dependencies = [], editor = nil) super("edition", [ Options::Option.builder .with_name("e", "edit") .with_description("Init the structure of the journal") .valued .with_action(lambda { |file| edit_entry(file) }) .build ]) # TODO C'mon, you're better than that @editor = editor.nil? ? Configuration::Configuration.load.editor : editor end |
Instance Method Details
#edit_entry(relative_path) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/bujo/plugins/edit_plugin.rb', line 26 def edit_entry(relative_path) puts "Editing entry..." @editor.call(relative_path) puts "Converting to HTML..." Utils::Converter.for(relative_path).convert end |