Class: Jekyll::Compose::FileEditor
- Inherits:
-
Object
- Object
- Jekyll::Compose::FileEditor
- Defined in:
- lib/jekyll-compose/file_editor.rb
Class Attribute Summary collapse
-
.compose_config ⇒ Object
(also: jekyll_compose_config)
readonly
Returns the value of attribute compose_config.
Class Method Summary collapse
- .auto_open? ⇒ Boolean
- .bootstrap(config) ⇒ Object
- .open_editor(filepath) ⇒ Object
- .post_editor ⇒ Object
- .run_editor(editor_name, filepath) ⇒ Object
Class Attribute Details
.compose_config ⇒ Object (readonly) Also known as: jekyll_compose_config
Returns the value of attribute compose_config.
19 20 21 |
# File 'lib/jekyll-compose/file_editor.rb', line 19 def compose_config @compose_config end |
Class Method Details
.auto_open? ⇒ Boolean
40 41 42 |
# File 'lib/jekyll-compose/file_editor.rb', line 40 def auto_open? compose_config["auto_open"] end |
.bootstrap(config) ⇒ Object
22 23 24 |
# File 'lib/jekyll-compose/file_editor.rb', line 22 def bootstrap(config) @compose_config = config["jekyll_compose"] || {} end |
.open_editor(filepath) ⇒ Object
26 27 28 |
# File 'lib/jekyll-compose/file_editor.rb', line 26 def open_editor(filepath) run_editor(post_editor, File.(filepath)) if post_editor end |
.post_editor ⇒ Object
34 35 36 37 38 |
# File 'lib/jekyll-compose/file_editor.rb', line 34 def post_editor return unless auto_open? ENV["JEKYLL_EDITOR"] || ENV["VISUAL"] || ENV["EDITOR"] end |
.run_editor(editor_name, filepath) ⇒ Object
30 31 32 |
# File 'lib/jekyll-compose/file_editor.rb', line 30 def run_editor(editor_name, filepath) system("#{editor_name} #{filepath}") end |