【问题标题】:Ruby, uninitialized constantRuby,未初始化的常量
【发布时间】:2012-06-13 04:41:42
【问题描述】:

我收到此错误:

第 12 行的未初始化常量 OU (NameError)

我做错了什么?

require 'win32ole'
domain = "dc=Troptrain,dc=net,dc=au"
ou = "studentsOU"

ad = WIN32OLE.connect("LDAP://#{OU}, #{domain}'")        # <== (line 12)
def errorcheck
  puts "Please enter the file name and location"
  file = gets.chomp.to_s
  #open file
  f1 = File.open(file,"r")
  #setup loop
  f1. each do |line|
    #split information
    info = line.split(',')
    #get informatio position 
    firstname = info[0]
    lastname = info[1]
    dob = info[2]
    snumber = info[3]
    eos = info[4]
    sarea = info[5]

    if ((firstname == ''))
      puts "No firstname found."
      puts ""
      system "pause"
      next
    end

【问题讨论】:

    标签: ruby


    【解决方案1】:

    Ruby 区分大小写。将“#{OU}”更改为“#{ou}”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-28
      • 1970-01-01
      • 2012-07-03
      相关资源
      最近更新 更多