Bruno Kinoshita
Bruno Kinoshita

Reputation: 3

Getting value formatted as ["example"]

I'm working with NET-LDAP API using Ruby on Rails:

@ldap.search( :base => @treebase, :filter => @filter ) do |entry|
  entry.cn

When I get the entry.cn value it comes formatted as ["example"] How do I get this value without the characters [" "]?

Upvotes: 0

Views: 73

Answers (1)

Bassem Shaker
Bassem Shaker

Reputation: 36

["example"] means that you've got an array with one string.

To get the first element of an array in Rails you can call:

["example"].first

Upvotes: 2

Related Questions