Module: Tagalus

Defined in:
lib/tagalus.rb

Overview

to change the parser.

Defined Under Namespace

Classes: Account, Comment, Definition, Tag, TagalusError

Constant Summary collapse

VERSION =
'0.5.0'
API_ROOT =
'api.tagal.us'
AVAILABLE_PARSERS =

The list of parsers you are allowed to use with the tagalus module.

[:nokogiri, :hpricot, :rexml, :libxml]

Class Method Summary collapse

Class Method Details

.parserObject



51
52
53
# File 'lib/tagalus.rb', line 51

def self.parser
  @@parser
end

.parser=(val) ⇒ Object

Sets which XML parser to use. Must be in AVAILABLE_PARSERS

Raises:

  • (UnsupportedParserError)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/tagalus.rb', line 36

def self.parser=(val)
  raise UnsupportedParserError.new("An unsupported parser was provided: #{val}") unless AVAILABLE_PARSERS.include? val
  @@parser = val
  case @@parser
  when :nokogiri
    require 'nokogiri'
  when :hpricot
    require 'hpricot'
  when :rexml
    require 'rexml/document'
  when :libxml
    require 'libxml'
  end
end