Sha256: 967eae3f7e7e007d0dbbf020990fc6c5d8b7a38594d8f09efe90d2438f4f6b1f

Contents?: true

Size: 537 Bytes

Versions: 1

Compression:

Stored size: 537 Bytes

Contents

require 'rbconfig'

def x86_64_from_build_cpu
  RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64'
end

def x86_64_from_byte_length
  ['foo'].pack('p').size == 8 
end

def x86_64_from_arch_flag
  RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/
end

def darwin?
  RUBY_PLATFORM =~ /darwin/
end

def rubinius?
  Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == "rbx"
end

def x64?
  if darwin? && !rubinius?
    x86_64_from_arch_flag
  else
    x86_64_from_build_cpu || x86_64_from_byte_length
  end
end

puts x64? ? "x64" : "ia32"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
therubyracer-0.7.3 ext/v8/upstream/detect_cpu.rb