Class: ReFe::FunctionSearcher

Inherits:
Object
  • Object
show all
Includes:
Encoding
Defined in:
lib/refe/searcher.rb

Instance Method Summary collapse

Methods included from Encoding

#adjust_encoding, #shift_jis_platform?

Constructor Details

#initialize(table, policy) ⇒ FunctionSearcher

Returns a new instance of FunctionSearcher.



153
154
155
156
# File 'lib/refe/searcher.rb', line 153

def initialize( table, policy )
  @table = table
  @policy = policy
end

Instance Method Details

#search(keys) ⇒ Object



158
159
160
161
162
163
164
165
166
167
# File 'lib/refe/searcher.rb', line 158

def search( keys )
  results = @table.complete(keys)
  if @policy.should_print_content?(results)
    results.sort.each do |name|
      puts adjust_encoding(@table[name])
    end
  else
    @policy.print_names results
  end
end