Module: Athena::Util

Extended by:
Util
Included in:
Formats::XML, Formats::XML::BaseSpec, Parser, Record, Util
Defined in:
lib/athena/util.rb

Overview

#

A component of athena, the database file converter. #

#

Copyright © 2007-2008 University of Cologne, #

Albertus-Magnus-Platz,                              #
50932 Cologne, Germany                              #
                                                    #

Authors: #

Jens Wille <[email protected]>                                    #
                                                                        #

athena is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 3 of the License, or (at your option) any later # version. #

#

athena is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. #

#

You should have received a copy of the GNU General Public License along # with athena. If not, see <www.gnu.org/licenses/>. #

#

++

Instance Method Summary collapse

Instance Method Details

#verbose(what, klass = self.class, &block) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/athena/util.rb', line 33

def verbose(what, klass = self.class, &block)
  if $Verbose[what]
    klass.send(:define_method, :spit) { |msg|
      warn "*#{what}: #{msg}"
    }
    klass.send(:define_method, :indent) { |*level|
      '  ' * (level.first || 0)
    }

    instance_eval(&block)
  end
end