Class: VundleCli::Finder
- Inherits:
-
Object
- Object
- VundleCli::Finder
- Defined in:
- lib/vundle_cli/finder.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
-
#vimrc ⇒ Object
readonly
Returns the value of attribute vimrc.
Instance Method Summary collapse
- #find? ⇒ Boolean
- #get_list ⇒ Object
-
#initialize(options, plugin = '') ⇒ Finder
constructor
A new instance of Finder.
- #list ⇒ Object
Constructor Details
#initialize(options, plugin = '') ⇒ Finder
Returns a new instance of Finder.
6 7 8 9 10 |
# File 'lib/vundle_cli/finder.rb', line 6 def initialize(, plugin = '') @options = @vimrc = file_validate(.vimrc) @plugin = plugin end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/vundle_cli/finder.rb', line 4 def @options end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
4 5 6 |
# File 'lib/vundle_cli/finder.rb', line 4 def plugin @plugin end |
#vimrc ⇒ Object (readonly)
Returns the value of attribute vimrc.
4 5 6 |
# File 'lib/vundle_cli/finder.rb', line 4 def vimrc @vimrc end |
Instance Method Details
#find? ⇒ Boolean
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vundle_cli/finder.rb', line 28 def find? say "Searching..." found = false open(@vimrc, 'r').each { |l| matches = l.chomp.match(/^(Bundle|Plugin) (\S*)/) if matches plugin = matches[2].gsub(/[',]/, '') if plugin.downcase.include?(@plugin.downcase) say_ok "Found " say plugin found = true end end } found end |
#get_list ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vundle_cli/finder.rb', line 12 def get_list plugins = Array.new open(@vimrc, 'r').each { |l| matches = l.chomp.match(/^(Bundle|Plugin) (\S*)/) if matches plugins << matches[2].gsub(/[',]/, '') end } plugins end |
#list ⇒ Object
23 24 25 26 |
# File 'lib/vundle_cli/finder.rb', line 23 def list enable_paging say get_list.join("\n") end |