Class: Vimdb::Keys

Inherits:
Item
  • Object
show all
Defined in:
lib/vimdb/keys.rb

Class Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Item

all, #default_field, inherited, instance, item_name, #key, #tempfile

Constructor Details

- (Keys) initialize



8
9
10
11
# File 'lib/vimdb/keys.rb', line 8

def initialize
  @modifiers, @mode_map = self.class.config.values_at(:modifiers, :mode_map)
  @plugins_dir = Vimdb.plugins_dir
end

Class Attribute Details

+ (Object) config

Returns the value of attribute config



2
3
4
# File 'lib/vimdb/keys.rb', line 2

def config
  @config
end

Instance Method Details

- (Object) create



13
14
15
16
17
18
# File 'lib/vimdb/keys.rb', line 13

def create
  keys = parse_index_file create_index_file
  @leader ||= get_leader
  @modifiers[@leader] ||= 'L'
  keys + parse_map_file(create_map_file)
end

- (Object) fields



34
35
36
# File 'lib/vimdb/keys.rb', line 34

def fields
  [:key, :mode, :from, :desc]
end

- (Object) info



30
31
32
# File 'lib/vimdb/keys.rb', line 30

def info
  "Created using index.txt and :map"
end

- (Object) search(keys, query, options = {})



20
21
22
23
24
25
26
27
28
# File 'lib/vimdb/keys.rb', line 20

def search(keys, query, options = {})
  keys = super
  if options[:mode]
    keys.select! do |key|
      options[:mode].split('').any? {|m| key[:mode].include?(m) }
    end
  end
  keys
end