Sha256: e55ff4fdb777f34107daadc0d9bc93f2926c92419c1dea24ca64d7977564bc4e

Contents?: true

Size: 975 Bytes

Versions: 11

Compression:

Stored size: 975 Bytes

Contents

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

NODE_TYPE_DESCRIPS = []

ruby_version_code = RUBY_VERSION.gsub(/\./, '').to_i

nodes = Nodes.new
nodes.each do |name, node|
  members = node['members'] || {}
  version_range = node['version_range']
  if version_range.includes?(ruby_version_code) then
    node_name = node['name'].upcase
    member_names = [
      (members.keys[0] || 'NONE').upcase,
      (members.keys[1] || 'NONE').upcase,
      (members.keys[2] || 'NONE').upcase,
    ]
    NODE_TYPE_DESCRIPS << [ node_name, *member_names ]
  end
end

NODE_TYPE_DESCRIPS.concat [
  [ 'LAST'        , 'NONE'  , 'NONE'  , 'NONE'  ], 
]

Node_Type_Descrip = Struct.new(:name, :node1, :node2, :node3)

NODE_TYPE_DESCRIPS.map! { |x| Node_Type_Descrip.new(*x) }

NEN_TO_NODE_TYPE = {}
NODE_TYPE_DESCRIPS.each do |descrip|
  [descrip.node1, descrip.node2, descrip.node3].each do |nen|
    NEN_TO_NODE_TYPE[nen] ||= []
    NEN_TO_NODE_TYPE[nen] << descrip.name
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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