Method: Gonzui::CommandLineSearcher#initialize
- Defined in:
- lib/gonzui/cmdapp/search.rb
#initialize(config, options) ⇒ CommandLineSearcher
Returns a new instance of CommandLineSearcher.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gonzui/cmdapp/search.rb', line 14 def initialize(config, ) @config = config @dbm = DBM.open(@config, true) @out = (['out'] or STDOUT) @nlines = ['line-number'] @show_method = if ['context'] :show_context_lines elsif ['count'] :show_count else :show_line end @package_name = ['package'] @ncontexts = ['context'].to_i @search_method = :find_all @search_method = :find_all_by_prefix if ['prefix'] @search_method = :find_all_by_regexp if ['regexp'] @use_regexp = ['regexp'] @use_color = ['color'] @no_filename = ['no-filename'] @target_type = :all if ['type'] type = ['type'].intern eprintf("unknown type: #{type}") unless LangScan::Type.include?(type) @target_type = type end end |