Ron Jeffries <ronjeffries / REMOVEacm.org> writes:

> >b.rpc('ORWU HASKEY',['XUPROGMODE'])
> >b.rpc('ORQQPX NEW REMINDERS ACTIVE')
> >['O RX', 'I RX', 'UD RX', 'IV RX'].each { |val| b.rpc("ORWORDG IEN", [val]) }

> When I have a bunch of nearly-duplicate code like the above, I try
> to remove the duplication.Here the duplication isn't just "b.rpc",

I often face similar situation. To factorise or not. In cases where
the usage patterns are predictable, I'd factorise. However in the
above case, there is one usage pattern (using .each{block}) that
sticks out. Then I'd wonder whether factorising the others will make
code more uniform or not. That one exception to the otherwise regular
usage-patterns is really a sore in the eye.

Is it just me?

YS.