Module: Talking::Talkative

Defined in:
lib/talking.rb

Overview

Public: Incldue this stuff into your class to make it talkative.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



38
39
40
41
# File 'lib/talking.rb', line 38

def self.included(klass)
  klass.extend(Forwardable)
  klass.delegate([:say, :debug] => :mouth)
end

Instance Method Details

#mouthObject

Public: Configured mouth object.



44
45
46
47
48
49
# File 'lib/talking.rb', line 44

def mouth
  @mouth ||= Mouth.new(
    StreamVoice.new(STDERR),
    ENV['DEBUG'] == '1' ? StreamVoice.new(STDERR) : NullVoice.instance
  )
end