Question

I'm running into this syntax error with the below code and I can't figure out why ruby is complaining about it.

  def user_list
  server = Lumberg::Whm::Server.new(
  host: "localhost",
  hash: IO.read("/root/.accesshash")
)

results = server.account.list
accounts = result[:params][:acct].map {|a| a["user"] }

 end
end

Syntax error is as follows:

# bundle exec bin/userscan 
bin/userscan:3:in `require': /usr/src/userscan/lib/userscan.rb:131: syntax error, unexpected ':', expecting ')' (SyntaxError)
  host: "localhost",
       ^
/usr/src/userscan/lib/userscan.rb:131: syntax error, unexpected ',', expecting kEND
/usr/src/userscan/lib/userscan.rb:133: syntax error, unexpected ')', expecting kEND
    from bin/userscan:3

From what I know, the part it's complaining about -should- be okay. Obviously, the semi-colon is actually supposed to be there and the parenthesis should encompass the entirety of the two lines. I've played around with it a bit, but I just keep making it worse rather than better.

Any assistance with what I'm messing up here would be appreciated.

Was it helpful?

Solution

the syntax host: ".." is new to ruby 1.9. If you are using ruby 1.8, you must use the old syntax:

server = Lumberg::Whm::Server.new(
    :host => "localhost",
    :hash => IO.read("/root/.accesshash") )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top