Top Level Namespace

Defined Under Namespace

Modules: Nokogiri, XSD

Constant Summary collapse

ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
LIBDIR =
INCLUDEDIR =
HEADER_DIRS =

There’s no default include/lib dir on Windows. Let’s just add the Ruby ones and resort on the search path specified by INCLUDE and LIB environment variables

[
  # First search /opt/local for macports
  '/opt/local/include',

  # Then search /usr/local for people that installed from source
  '/usr/local/include',

  # Check the ruby install locations
  INCLUDEDIR,

  # Finally fall back to /usr
  '/usr/include',
  '/usr/include/libxml2',
]
LIB_DIRS =
[
  # First search /opt/local for macports
  '/opt/local/lib',

  # Then search /usr/local for people that installed from source
  '/usr/local/lib',

  # Check the ruby install locations
  LIBDIR,

  # Finally fall back to /usr
  '/usr/lib',
]
XML2_HEADER_DIRS =
[
  '/opt/local/include/libxml2',
  '/usr/local/include/libxml2',
  File.join(INCLUDEDIR, "libxml2")
] + HEADER_DIRS

Instance Method Summary collapse

Instance Method Details

#asplode(lib) ⇒ Object



100
101
102
# File 'ext/nokogiri/extconf.rb', line 100

def asplode(lib)
  abort "-----\n#{lib} is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.\n-----"
end

#have_iconv?Boolean

Returns:

  • (Boolean)


108
109
110
111
112
113
114
# File 'ext/nokogiri/extconf.rb', line 108

def have_iconv?
  %w{ iconv_open libiconv_open }.any? do |method|
    have_func(method, 'iconv.h') or
      have_library('iconv', method, 'iconv.h') or
      find_library('iconv', method, 'iconv.h')
  end
end

#Nokogiri(*args, &block) ⇒ Object

Parser a document contained in args. Nokogiri will try to guess what type of document you are attempting to parse. For more information, see Nokogiri.parse

To specify the type of document, use Nokogiri.XML or Nokogiri.HTML.



121
122
123
124
125
126
127
128
# File 'lib/nokogiri.rb', line 121

def Nokogiri(*args, &block)
  if block_given?
    builder = Nokogiri::HTML::Builder.new(&block)
    return builder.doc.root
  else
    Nokogiri.parse(*args)
  end
end