Module: Athena::Formats

Defined in:
lib/athena/formats.rb,
lib/athena/formats/dbm.rb,
lib/athena/formats/xml.rb,
lib/athena/formats/lingo.rb,
lib/athena/formats/sisis.rb,
lib/athena/formats/ferret.rb

Overview

#

A component of athena, the database file converter. #

#

Copyright © 2007-2009 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/>. #

#

++

Defined Under Namespace

Classes: Base, DBM, DirectionMismatchError, DuplicateFormatDefinitionError, Ferret, FormatArgumentError, Lingo, Sisis, XML

Class Method Summary collapse

Class Method Details

.[](direction, format) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/athena/formats.rb', line 31

def self.[](direction, format)
  if direction == :out
    if format.class < Base
      if format.class.direction != direction
        raise DirectionMismatchError,
          "expected #{direction}, got #{format.class.direction}"
      else
        format
      end
    else
      Base.formats[direction][format].new
    end
  else
    Base.formats[direction][format]
  end
end