Class: Notiffany::Notifier::Emacs::Client
- Inherits:
-
Object
- Object
- Notiffany::Notifier::Emacs::Client
- Defined in:
- lib/notiffany/notifier/emacs/client.rb
Overview
Handles evaluating ELISP code in Emacs via Erb
Defined Under Namespace
Classes: Elisp
Instance Attribute Summary collapse
-
#elisp_erb ⇒ Object
readonly
Returns the value of attribute elisp_erb.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #notify(color, bgcolor, message = nil) ⇒ Object
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
28 29 30 31 32 |
# File 'lib/notiffany/notifier/emacs/client.rb', line 28 def initialize() @client = [:client] @elisp_erb = [:elisp_erb] raise ArgumentError, 'No :elisp_erb option given!' unless elisp_erb end |
Instance Attribute Details
#elisp_erb ⇒ Object (readonly)
Returns the value of attribute elisp_erb.
7 8 9 |
# File 'lib/notiffany/notifier/emacs/client.rb', line 7 def elisp_erb @elisp_erb end |
Instance Method Details
#available? ⇒ Boolean
34 35 36 37 |
# File 'lib/notiffany/notifier/emacs/client.rb', line 34 def available? script = Elisp.new(@elisp_erb, nil, nil, nil).result _emacs_eval({ 'ALTERNATE_EDITOR' => 'false' }, script) end |
#notify(color, bgcolor, message = nil) ⇒ Object
39 40 41 42 |
# File 'lib/notiffany/notifier/emacs/client.rb', line 39 def notify(color, bgcolor, = nil) elisp = Elisp.new(elisp_erb, color, bgcolor, ).result _emacs_eval({ 'ALTERNATE_EDITOR' => 'false' }, elisp) end |