Class: Vcsmap::Plugin::GithubSublimesettings

Inherits:
BasePlugin
  • Object
show all
Defined in:
lib/vcsmap/plugins/github_sublimesettings.rb

Instance Attribute Summary

Attributes inherited from BasePlugin

#search_string

Instance Method Summary collapse

Methods inherited from BasePlugin

#capture_match

Constructor Details

#initializeGithubSublimesettings

Returns a new instance of GithubSublimesettings.



4
5
6
7
# File 'lib/vcsmap/plugins/github_sublimesettings.rb', line 4

def initialize
  @search_string = 'filename:GitHub.sublime-settings+github_token'
  @token_regex = /(?:\"|')github_token(?:\"|')\:(?:\ |)(?:\"|')(.*?)(?:\"|')/i
end

Instance Method Details

#credentials(file) ⇒ Object



9
10
11
12
13
14
# File 'lib/vcsmap/plugins/github_sublimesettings.rb', line 9

def credentials(file)
  @token = capture_match(@token_regex, file)
  ['GitHub token', @token]
rescue NoMethodError
  []
end

#table_headerObject



16
17
18
# File 'lib/vcsmap/plugins/github_sublimesettings.rb', line 16

def table_header
  %w(Protocol Token)
end