lib/rbkb/cli/rstrings.rb in emonti-rbkb-0.6.2.1 vs lib/rbkb/cli/rstrings.rb in emonti-rbkb-0.6.6

- old
+ new

@@ -4,19 +4,22 @@ # See README.rdoc for license information # # rstrings is Unix "strings" in ruby... with some extra stuff class Rbkb::Cli::Rstrings < Rbkb::Cli::Executable def initialize(*args) - super(*args) - { - :start_off => 0, - :end_off => -1, - :encoding => :both, - :minimum => 6, - :align => nil, - :indat => Array.new, - :fnames => Array.new, - }.each {|k,v| @opts[k] ||= v } + super(*args) do |this| + { + :start_off => 0, + :end_off => -1, + :encoding => :both, + :minimum => 6, + :align => nil, + :indat => Array.new, + :fnames => Array.new, + }.each {|k,v| this.opts[k] ||= v } + + yield this if block_given? + end end def make_parser() arg = super() arg.banner += " <file ... || blank for stdin>"