class Acupunt
include Enumerable
attr_reader :afk, :name,:chname, :locatie, :aard, :actie
def initialize(arr)
set_instance_variables arr
end
def set_instance_variables arr
@afk=arr[0]
@name=arr[1]
@chname=arr[2]
@locatie=arr[3]
@aard=arr[4]
@actie=arr[5..-1]
end
def each
yield "#{@afk}"
yield "#{@name}"
yield "#{@chname}"
yield "#{@locatie}"
yield "#{@aard}"
yield "#{@actie}"
end
def search str
self.include? str
end
end
ac = Acupunt.new(["bl", "witte vloed", "tingwell", "6cun vanaf",
"Luo","klaart hitte","2de","en een 3de"])
ac.search "bl" #This yields true
ac.search "hitte" #this yields false, but I want it to be true
Op 21-2-2012 19:24, Brian Candler schreef:
> Firstly, post a complete small program which demonstrates your problem -
> something we can actually run and see exactly the same as you do. And
> copy-paste it exactly (or post a URL to pastebin or similar)
>
> And secondly: include? will test each member you yield individually. If
> the member you yield is an array, then it will only match another
> identical array.
>