Class: AppRelease::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/app_release/console.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, color = nil) ⇒ Console

Returns a new instance of Console.



25
26
27
28
# File 'lib/app_release/console.rb', line 25

def initialize(text, color = nil)
  @text = text
  @color = color
end

Class Method Details

.danger(text) ⇒ Object



21
22
23
# File 'lib/app_release/console.rb', line 21

def self.danger(text)
  new(text, :red).print
end

.log(text) ⇒ Object



9
10
11
# File 'lib/app_release/console.rb', line 9

def self.log(text)
  new(text, nil).print
end


5
6
7
# File 'lib/app_release/console.rb', line 5

def self.print(text, color = nil)
  new(text, color).print
end

.success(text) ⇒ Object



13
14
15
# File 'lib/app_release/console.rb', line 13

def self.success(text)
  new(text, :green).print
end

.warning(text) ⇒ Object



17
18
19
# File 'lib/app_release/console.rb', line 17

def self.warning(text)
  new(text, :yellow).print
end

Instance Method Details



30
31
32
# File 'lib/app_release/console.rb', line 30

def print
  puts @text.colorize(@color)
end