Class: NotifySend
- Inherits:
-
Object
- Object
- NotifySend
- Defined in:
- lib/notify-send.rb
Constant Summary collapse
- DEFAULTS =
{ app_name: __FILE__, id: 0, icon: 'info', summary: '', body: '', actions: [], hints: {}, timeout: 2000 }
- @@interface =
nil
Class Method Summary collapse
Class Method Details
.send(first, *others) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/notify-send.rb', line 17 def self.send(first, *others) if first.is_a?(Hash) and others.length == 0 _send first elsif first.respond_to?(:to_s) and others.length < 4 _send [:body, :icon, :timeout].zip(others).each_with_object({summary: first}) { |(k, v), obj| obj[k] = v unless v.nil? } else raise ArgumentError.new("Invalid arguments") end # _send DEFAULTS.merge(first.is_a?(Hash) ? first : {summary: first, body: others[0]}) end |