Getting value formatted as ["example"]

79 Views Asked by At

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 [" "]?

1

There are 1 best solutions below

0
Bassem Shaker On BEST ANSWER

["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