I
ixnay
Greetings all.
Hopefully I've described this adequately and someone can see what I'm
missing. I have a feeling it's obvious. I've been using the Song and
SongList examples from the Pragmatic Programmer's guide, but I'm stuck on
one thing.
I have a class called StepList and in that class I have an each method as
such:
class StepList
def initialize
@guides = Array.new
end
def each
@guides.find { |guide| guide.filter }
end
end
If I put a "puts" in front of the guide.filter, I see that this is working
correctly by just grabbing the values I want. However, the results are never
passed back. For example, I have this:
$stepList.each { |thisFilter|
puts "test"
puts thisFilter
}
What I'm trying to do is get the value of each filter and have that get
placed in thisFilter each time through the loop. What happens is that
nothing happens! I do not even see the "test" text get printed out. Yet, it
seems the each must be looping because the guide.filter in my my each method
does return values if I put a puts in front of it.
Hopefully I've provided enough information here. Any help would be
appreciated.
- Jeff
Hopefully I've described this adequately and someone can see what I'm
missing. I have a feeling it's obvious. I've been using the Song and
SongList examples from the Pragmatic Programmer's guide, but I'm stuck on
one thing.
I have a class called StepList and in that class I have an each method as
such:
class StepList
def initialize
@guides = Array.new
end
def each
@guides.find { |guide| guide.filter }
end
end
If I put a "puts" in front of the guide.filter, I see that this is working
correctly by just grabbing the values I want. However, the results are never
passed back. For example, I have this:
$stepList.each { |thisFilter|
puts "test"
puts thisFilter
}
What I'm trying to do is get the value of each filter and have that get
placed in thisFilter each time through the loop. What happens is that
nothing happens! I do not even see the "test" text get printed out. Yet, it
seems the each must be looping because the guide.filter in my my each method
does return values if I put a puts in front of it.
Hopefully I've provided enough information here. Any help would be
appreciated.
- Jeff