Class: Jekyll::Compose::FileEditor
- Inherits:
-
Object
- Object
- Jekyll::Compose::FileEditor
- Defined in:
- lib/jekyll-compose/file_editor.rb
Class Method Summary collapse
- .auto_open? ⇒ Boolean
- .jekyll_compose_config ⇒ Object
- .open_editor(filepath) ⇒ Object
- .post_editor ⇒ Object
- .run_editor(editor_name, filepath) ⇒ Object
Class Method Details
.auto_open? ⇒ Boolean
31 32 33 |
# File 'lib/jekyll-compose/file_editor.rb', line 31 def auto_open? jekyll_compose_config && jekyll_compose_config['auto_open'] end |
.jekyll_compose_config ⇒ Object
35 36 37 |
# File 'lib/jekyll-compose/file_editor.rb', line 35 def jekyll_compose_config @jekyll_compose_config ||= Jekyll.configuration['jekyll_compose'] end |
.open_editor(filepath) ⇒ Object
18 19 20 |
# File 'lib/jekyll-compose/file_editor.rb', line 18 def open_editor(filepath) run_editor(post_editor, File.(filepath)) if post_editor end |
.post_editor ⇒ Object
26 27 28 29 |
# File 'lib/jekyll-compose/file_editor.rb', line 26 def post_editor return unless auto_open? ENV['JEKYLL_EDITOR'] || ENV['EDITOR'] end |
.run_editor(editor_name, filepath) ⇒ Object
22 23 24 |
# File 'lib/jekyll-compose/file_editor.rb', line 22 def run_editor(editor_name, filepath) system("#{editor_name} #{filepath}") end |