Method: MARC::XMLReader.choose_parser

Defined in:
lib/marc/xmlreader.rb

.choose_parser(p) ⇒ Object

Raises:

  • (ArgumentError)


182
183
184
185
186
187
188
189
190
191
192
# File 'lib/marc/xmlreader.rb', line 182

def choose_parser(p)
  match = false
  constants.each do |const|
    next unless const.to_s.match?("^USE_")
    if const_get(const) == p
      match = true
      return p
    end
  end
  raise ArgumentError.new("Parser '#{p}' not defined") unless match
end