Module: VideoTranscoding::Console

Extended by:
Console
Included in:
Console
Defined in:
lib/video_transcoding/console.rb

Constant Summary collapse

OFF =
0
ERROR =
1
WARN =
2
INFO =
3
DEBUG =
4

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#speakerObject

Returns the value of attribute speaker.



27
28
29
# File 'lib/video_transcoding/console.rb', line 27

def speaker
  @speaker
end

#volumeObject

Returns the value of attribute volume.



28
29
30
# File 'lib/video_transcoding/console.rb', line 28

def volume
  @volume
end

Class Method Details

.extended(base) ⇒ Object



19
20
21
22
23
# File 'lib/video_transcoding/console.rb', line 19

def self.extended(base)
  fail "#{self} singleton can't be extended by #{base}" unless base.class == Module
  @speaker = ->(msg) { Kernel.warn msg }
  @volume = WARN
end

.included(base) ⇒ Object



15
16
17
# File 'lib/video_transcoding/console.rb', line 15

def self.included(base)
  fail "#{self} singleton can't be included by #{base}"
end

Instance Method Details

#debug(msg) ⇒ Object



42
43
44
# File 'lib/video_transcoding/console.rb', line 42

def debug(msg)
  @speaker.call msg unless @speaker.nil? or @volume < DEBUG
end

#error(msg) ⇒ Object



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

def error(msg)
  @speaker.call msg unless @speaker.nil? or @volume < ERROR
end

#info(msg) ⇒ Object



38
39
40
# File 'lib/video_transcoding/console.rb', line 38

def info(msg)
  @speaker.call msg unless @speaker.nil? or @volume < INFO
end

#warn(msg) ⇒ Object



34
35
36
# File 'lib/video_transcoding/console.rb', line 34

def warn(msg)
  @speaker.call msg unless @speaker.nil? or @volume < WARN
end