Better Ruby way?

On Fri, Nov 7, 2014 at 6:02 PM, Bryce K. [email protected]
wrote:

Leave for a firm that isn’t actively hostile to good development practices. I’ve
been at places with significant management resistance to upgrading and it made me
miserable.

I do not know anything about the specifics of the company involved,
but from a business perspective the decision to not jump onto any
bandwagon that’s been driven through the IT community actually makes a
lot sense. And it is not necessary the opposite of “good development
practices” to not upgrade to the greatest and latest tools available.
In my opinion every company needs to balance this according to their
own judgement. And my general impression is that people too readily
adopt new technologies. If you do that all the time you never reach a
level of mastery with one tool and that actually hurts productivity.

Having said that 1.8.7 also in my book is too dated - no security
fixes, a slower interpreter - there are tons of reasons to move on to
a more modern version. Still there may be environments which cannot
that easily change.

Kind regards

robert

Thanks!

The script is a lot cleaner now.

require ‘optparse’
options = {}
OptionParser.new do |opts|
opts.banner = “Usage: check_sum.rb -t TOOL -f FILE -s SUM.”
opts.on(’-t’, ‘–sumtool TOOL’) { |v| options[:sum_tool] = v }
opts.on(’-f’, ‘–file FILE’) { |v| options[:file] = v }
opts.on(’-s’, ‘–sum SUM’) { |v| options[:sum_given] = v }
end.parse!

command_result = #{options[:sum_tool]} #{options[:file]}.chop.split
sum_result = command_result[0]

if options[:sum_given].to_s === sum_result.to_s
puts “The sum is correct.”
else
puts “The sums don’t match.”
end


Mind on a Mission