Class: PairingMatrix::RemoteRepos

Inherits:
Object
  • Object
show all
Defined in:
lib/pairing_matrix/config/remote_repos.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authors_regex, repos, access_token, url) ⇒ RemoteRepos

Returns a new instance of RemoteRepos.



5
6
7
8
9
10
# File 'lib/pairing_matrix/config/remote_repos.rb', line 5

def initialize(authors_regex, repos, access_token, url)
    @url = url
    @repositories = repos
    @authors_regex = authors_regex
    @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



3
4
5
# File 'lib/pairing_matrix/config/remote_repos.rb', line 3

def access_token
  @access_token
end

#authors_regexObject (readonly)

Returns the value of attribute authors_regex.



3
4
5
# File 'lib/pairing_matrix/config/remote_repos.rb', line 3

def authors_regex
  @authors_regex
end

#repositoriesObject (readonly)

Returns the value of attribute repositories.



3
4
5
# File 'lib/pairing_matrix/config/remote_repos.rb', line 3

def repositories
  @repositories
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/pairing_matrix/config/remote_repos.rb', line 3

def url
  @url
end

Class Method Details

.create_from(authors_regex, config) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/pairing_matrix/config/remote_repos.rb', line 12

def self.create_from(authors_regex, config)
    repos = config['repositories'] rescue []
    access_token = config['access_token'] rescue nil
    url = config['url'] rescue nil

    RemoteRepos.new(authors_regex, repos, access_token, url)
end

Instance Method Details

#absent?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/pairing_matrix/config/remote_repos.rb', line 24

def absent?
    @repositories.empty?
end

#has_access_token?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/pairing_matrix/config/remote_repos.rb', line 20

def has_access_token?
    !@access_token.nil? && !@access_token.empty?
end