Class: ArchitectureJS::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/architecture-js/notification.rb

Constant Summary collapse

@@indicators =
{
  none: "",
  log: "\e[32m>>>\e[0m ",
  event: "\e[33m<<<\e[0m ",
  added: "\e[32m+++\e[0m ",
  error: "\e[0;31m!!!\e[0m ",
  prompt: ">>> "
}

Class Method Summary collapse

Class Method Details

.added(message) ⇒ Object



46
47
48
# File 'lib/architecture-js/notification.rb', line 46

def self.added(message)
  self.notify :added, message
end

.error(message) ⇒ Object



50
51
52
# File 'lib/architecture-js/notification.rb', line 50

def self.error(message)
  self.notify :error, message
end

.event(message) ⇒ Object



42
43
44
# File 'lib/architecture-js/notification.rb', line 42

def self.event(message)
  self.notify :event, message
end

.log(message) ⇒ Object



38
39
40
# File 'lib/architecture-js/notification.rb', line 38

def self.log(message)
  self.notify :log, message
end

.notice(message) ⇒ Object



34
35
36
# File 'lib/architecture-js/notification.rb', line 34

def self.notice(message)
  self.notify :none, message 
end

.notify(type, message) ⇒ Object



29
30
31
32
# File 'lib/architecture-js/notification.rb', line 29

def self.notify(type, message)
  raise "There is no #{type} indicator" unless @@indicators[type]
  "#{@@indicators[type]}#{message}"
end

.promptObject



54
55
56
# File 'lib/architecture-js/notification.rb', line 54

def self.prompt
  self.notify :prompt, ''
end