Class: Notify

Inherits:
Object
  • Object
show all
Defined in:
lib/notifaction/notify.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.auto_quit_enabled(config) ⇒ Object

Since:

  • 0.3.0



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(message, title)
  if Utils.os == :macosx
    handler = Notifaction::Type::OSX.new
  else
    handler = Notifaction::Type::Linux.new
  end

  handler.bubble(message, title)
  handler.quit
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Notify)

    the object that the method was called on



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(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.error(message, 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(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.info(message, config)
end


14
15
16
17
18
19
20
21
22
23
# File 'lib/notifaction/notify.rb', line 14

def self.modal(message, title)
  if Utils.os == :macosx
    handler = Notifaction::Type::OSX.new
  else
    handler = Notifaction::Type::Linux.new
  end

  handler.modal(message, title)
  handler.quit
end

.note(message, config = {}) ⇒ Object



50
51
52
53
# File 'lib/notifaction/notify.rb', line 50

def self.note(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.note(message, 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


84
85
86
# File 'lib/notifaction/notify.rb', line 84

def self.print_output
  true
end


88
89
90
# File 'lib/notifaction/notify.rb', line 88

def self.print_timestamps
  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(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.note(message, 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(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.spit(message, 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(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.success(message, 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(message, config = {})
  handler = Notifaction::Type::Terminal.new
  handler.warning(message, 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(message, print_info_message = false)
  self.deprecation_notice("0.3.0")
end

Instance Method Details

#deprecation_notice(version) ⇒ Object

Since:

  • 0.2.8



101
102
103
# File 'lib/notifaction/notify.rb', line 101

def deprecation_notice(version)
  puts "Deprecated as of #{version}, current #{Notifaction::VERSION}"
end