Hello, I have a text processing thing I'm doing in Ruby. Basically, I have to implement a simple state machine(with one character look-behind
My code at the moment looks like this:
text.each{ |c|
...
...
...
...
if @state!=:some_state
next
end
#processing stuff for if in :some_state mode
...
...
...
...
...
}
Is this proper? Or should it rather be implemented like
text.each{ |c|
...
...
...
...
if @state==:some_state
#processing stuff for if in :some_state mode
...
...
...
...
...
end
}
Is there a right way or is it just preference? Which one blends more with "the ruby" way of doing things?