Module: Narrator

Included in:
Object
Defined in:
lib/extensions/narrator.rb

Instance Method Summary collapse

Instance Method Details

#narrate(text) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/extensions/narrator.rb', line 2

def narrate(text)
  return unless Fabric.options[:narrate]    
  narration = ''
  
  if self.respond_to?(:narrate_as)
    narration << "[#{self.narrate_as}]"
  else
    narration << "[#{self.class.to_s.downcase}]"
  end
  narration << " #{text}"
  
  puts narration
end