Skip to content

Instantly share code, notes, and snippets.

@th507
Forked from henry0312/make_ruby_dict.rb
Last active December 23, 2015 14:29
Show Gist options
  • Select an option

  • Save th507/6649496 to your computer and use it in GitHub Desktop.

Select an option

Save th507/6649496 to your computer and use it in GitHub Desktop.
making dictionary for vim autocomplete from http://henry.animeo.jp/wp/?p=1764 remove trailing =, ?
#!/usr/bin/env ruby
require 'uri'
if ARGV.size != 1
warn "Invalid argument"
exit
end
methods = []
Dir.glob(File.expand_path(ARGV[0]) + "/**/*.ri").each do |file|
method = URI.decode(File.basename(file))
if /^(.*)-\w*\.ri$/ =~ method
methods << ($1).sub(/(=|\?|\||~)$/, '')
else
warn file
end
end
methods.uniq!.sort.each do |method|
puts method
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment