Sha256: e27d1d9aac81000ac8ad1e0bfb763f032f97381c5e42ff0c07cc43bf1c9bdb29

Contents?: true

Size: 603 Bytes

Versions: 11

Compression:

Stored size: 603 Bytes

Contents

$: << '../..'
require 'ruby_source_dir'

NODE_H_LOCATION = "#{RUBY_INCLUDE_DIR}/node.h"
NODE_H_ALT_LOCATION = "#{RUBY_SOURCE_DIR}/node.h"

def open_alt(*files, &block)
  last_exc = nil
  files.each do |file|
    begin
      File.open(file, &block)
      return
    rescue Errno::ENOENT
      last_exc = $!
    end
  end
  raise last_exc
end

NODEINFO = Hash.new
open_alt(NODE_H_LOCATION, NODE_H_ALT_LOCATION) do |node_h|
  while line = node_h.gets do
    case line
    when /^#define\s+nd_(\w+)\s+(.*)/
      NODEINFO[$1] = $2
    end
  end
end

if __FILE__ == $0 then
  require 'pp'
  pp NODEINFO
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruby-internal-0.8.5 ext/internal/node/read_node_h.rb
ruby-internal-0.8.4 ext/internal/node/read_node_h.rb
ruby-internal-0.8.3 ext/internal/node/read_node_h.rb
ruby-internal-0.8.2 ext/internal/node/read_node_h.rb
ruby-internal-0.8.1 ext/internal/node/read_node_h.rb
ruby-internal-0.8.0 ext/internal/node/read_node_h.rb
ruby-internal-0.7.3 ext/internal/node/read_node_h.rb
ruby-internal-0.7.2 ext/internal/node/read_node_h.rb
ruby-internal-0.7.1 ext/internal/node/read_node_h.rb
ruby-internal-0.7.0 ext/internal/node/read_node_h.rb
ruby-internal-0.6.0 ext/internal/node/read_node_h.rb