Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
No difference between .. and ... flip/flop operators?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Gavin Sinclair, post: 4424798"] Nice implementation. The usage is still more verbose than the FF operator, though. Perhaps some method to process an enumerable object? # Untested class FlipFlop def process(enum) enum.each do |o| yield(o) if self === o end end end File.open(path) do |io| FlipFlop.new(/BEGIN/, /END/).process(io) do |line| puts line end end Is that any good? Gavin [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
No difference between .. and ... flip/flop operators?
Top