Class: EmacsRuby::Emacs
- Inherits:
-
Object
- Object
- EmacsRuby::Emacs
- Defined in:
- lib/emacs-ruby/emacs.rb
Instance Attribute Summary collapse
-
#emacs ⇒ Object
Returns the value of attribute emacs.
Instance Method Summary collapse
- #batch(target: nil, load: nil, func: nil) ⇒ Object
-
#initialize ⇒ Emacs
constructor
A new instance of Emacs.
- #org_to_html(org_file, load: nil, func: 'org-html-export-to-html') ⇒ Object
Constructor Details
#initialize ⇒ Emacs
Returns a new instance of Emacs.
5 6 7 |
# File 'lib/emacs-ruby/emacs.rb', line 5 def initialize @emacs = 'emacs' end |
Instance Attribute Details
#emacs ⇒ Object
Returns the value of attribute emacs.
3 4 5 |
# File 'lib/emacs-ruby/emacs.rb', line 3 def emacs @emacs end |
Instance Method Details
#batch(target: nil, load: nil, func: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/emacs-ruby/emacs.rb', line 21 def batch(target: nil, load: nil, func: nil) return unless func cmd = [@emacs] cmd << target if target cmd << '--batch' cmd += ['-l', load] if load cmd += ['-f', func] if func cmd << '--kill' `#{cmd.join ' '}` end |
#org_to_html(org_file, load: nil, func: 'org-html-export-to-html') ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/emacs-ruby/emacs.rb', line 9 def org_to_html(org_file, load: nil, func: 'org-html-export-to-html') html = nil batch target: org_file, load: load, func: func html_file = org_file.sub(/.org$/, '.html') return html unless File.exist? html_file File.open(html_file) do |file| html = file.read end FileUtils.rm_rf html_file html end |