Class: Notify
- Inherits:
-
Object
- Object
- Notify
- Defined in:
- lib/notifaction/notify.rb
Class Method Summary collapse
- .auto_quit_enabled(config) ⇒ Object
-
.bubble(message, title) ⇒ Object
Display a notification bubble.
- .configure {|_self| ... } ⇒ Object
-
.error(message, config = {}) ⇒ Object
Prints a pre-formatted error message to the console.
-
.info(message, config = {}) ⇒ Object
Prints a pre-formatted informational message to the console.
- .modal(message, title) ⇒ Object
- .note(message, config = {}) ⇒ Object
-
.plugins=(plugin_config_arr) ⇒ Object
register new plugins.
- .print_output ⇒ Object
- .print_timestamps ⇒ Object
-
.sinfo(message, config = {}) ⇒ Object
Prints a pre-formatted secondary informational message to the console.
-
.spacer(config = {}) ⇒ Object
pretty-print a spacer.
-
.spit(message, config = {}) ⇒ Object
Prints a pre-formatted unstyled message to the console.
-
.success(message, config = {}) ⇒ Object
Prints a pre-formatted success message to the console.
-
.warning(message, config = {}) ⇒ Object
Prints a pre-formatted warning message to the console.
-
.workingon(message, print_info_message = false) ⇒ Object
Send status updates to WorkingOn.
Instance Method Summary collapse
Class Method Details
.auto_quit_enabled(config) ⇒ Object
107 108 109 |
# File 'lib/notifaction/notify.rb', line 107 def self.auto_quit_enabled(config) config[:auto_quit] == false || $config.conf["auto_quit"] == false end |
.bubble(message, title) ⇒ Object
Display a notification bubble
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/notifaction/notify.rb', line 3 def self.bubble(, title) if Utils.os == :macosx handler = Notifaction::Type::OSX.new else handler = Notifaction::Type::Linux.new end handler.bubble(, title) handler.quit end |
.configure {|_self| ... } ⇒ Object
78 79 80 81 82 |
# File 'lib/notifaction/notify.rb', line 78 def self.configure self.deprecation_notice("0.3.0") yield self if block_given? end |
.error(message, config = {}) ⇒ Object
Prints a pre-formatted error message to the console
26 27 28 29 30 |
# File 'lib/notifaction/notify.rb', line 26 def self.error(, config = {}) handler = Notifaction::Type::Terminal.new handler.error(, config) handler.quit unless self.auto_quit_enabled(config) end |
.info(message, config = {}) ⇒ Object
Prints a pre-formatted informational message to the console
39 40 41 42 |
# File 'lib/notifaction/notify.rb', line 39 def self.info(, config = {}) handler = Notifaction::Type::Terminal.new handler.info(, config) end |
.modal(message, title) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/notifaction/notify.rb', line 14 def self.modal(, title) if Utils.os == :macosx handler = Notifaction::Type::OSX.new else handler = Notifaction::Type::Linux.new end handler.modal(, title) handler.quit end |
.note(message, config = {}) ⇒ Object
50 51 52 53 |
# File 'lib/notifaction/notify.rb', line 50 def self.note(, config = {}) handler = Notifaction::Type::Terminal.new handler.note(, config) end |
.plugins=(plugin_config_arr) ⇒ Object
register new plugins
93 94 95 |
# File 'lib/notifaction/notify.rb', line 93 def self.plugins=(plugin_config_arr) self.deprecation_notice("0.3.0") end |
.print_output ⇒ Object
84 85 86 |
# File 'lib/notifaction/notify.rb', line 84 def self.print_output true end |
.print_timestamps ⇒ Object
88 89 90 |
# File 'lib/notifaction/notify.rb', line 88 def self. true end |
.sinfo(message, config = {}) ⇒ Object
Prints a pre-formatted secondary informational message to the console
45 46 47 48 |
# File 'lib/notifaction/notify.rb', line 45 def self.sinfo(, config = {}) handler = Notifaction::Type::Terminal.new handler.note(, config) end |
.spacer(config = {}) ⇒ Object
pretty-print a spacer
73 74 75 76 |
# File 'lib/notifaction/notify.rb', line 73 def self.spacer(config = {}) handler = Notifaction::Type::Terminal.new handler.spacer(config) end |
.spit(message, config = {}) ⇒ Object
Prints a pre-formatted unstyled message to the console
62 63 64 65 |
# File 'lib/notifaction/notify.rb', line 62 def self.spit(, config = {}) handler = Notifaction::Type::Terminal.new handler.spit(, config) end |
.success(message, config = {}) ⇒ Object
Prints a pre-formatted success message to the console
56 57 58 59 |
# File 'lib/notifaction/notify.rb', line 56 def self.success(, config = {}) handler = Notifaction::Type::Terminal.new handler.success(, config) end |
.warning(message, config = {}) ⇒ Object
Prints a pre-formatted warning message to the console
33 34 35 36 |
# File 'lib/notifaction/notify.rb', line 33 def self.warning(, config = {}) handler = Notifaction::Type::Terminal.new handler.warning(, config) end |
.workingon(message, print_info_message = false) ⇒ Object
Send status updates to WorkingOn
68 69 70 |
# File 'lib/notifaction/notify.rb', line 68 def self.workingon(, = false) self.deprecation_notice("0.3.0") end |
Instance Method Details
#deprecation_notice(version) ⇒ Object
101 102 103 |
# File 'lib/notifaction/notify.rb', line 101 def deprecation_notice(version) puts "Deprecated as of #{version}, current #{Notifaction::VERSION}" end |