Top Level Namespace

Defined Under Namespace

Modules: CharDet, Enumerable, TMail Classes: Array, FalseClass, Hash, NilClass, Numeric, Object, String, StringInput, StringOutput, TrueClass

Instance Method Summary collapse

Instance Method Details

#require_arch(fname) ⇒ Object

Attempts to require anative extension. Falls back to pure-ruby version, if it fails.

This uses Config::CONFIG from rbconfig.


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tmail/require_arch.rb', line 9

def require_arch(fname)
  arch = Config::CONFIG['arch']
  begin
    path = File.join("tmail", arch, fname)
    require path
  rescue LoadError => e
    # try pre-built Windows binaries
    if arch =~ /mswin/
      require File.join("tmail", 'mswin32', fname)
    else
      raise e
    end
  end
end