A
Anderson Leite
How can I compare two objects and get true if some of his atributes are
equals ?
I need to compare two arrays of users, and get and third array just with
the matches. I found the "&" method that work for Fixnuns and String,
but...how to use with objects ?
class User
attr_accessor :email
end
a = User.new
a.email = '(e-mail address removed)'
b = User.new
b.email = '(e-mail address removed)'
array_one = [a]
array_two =
array_three = array_one & array_two
puts array_three # I want the user here
Can you help me ?
thanks
equals ?
I need to compare two arrays of users, and get and third array just with
the matches. I found the "&" method that work for Fixnuns and String,
but...how to use with objects ?
class User
attr_accessor :email
end
a = User.new
a.email = '(e-mail address removed)'
b = User.new
b.email = '(e-mail address removed)'
array_one = [a]
array_two =
array_three = array_one & array_two
puts array_three # I want the user here
Can you help me ?
thanks