Class: Mutant::License::Subscription::Repository Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/license/subscription/repository.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

REMOTE_REGEXP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/\A[^\t]+\t(?<url>[^ ]+) \((?:fetch|push)\)\n\z/
GIT_SSH_REGEXP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%r{\A[^@]+@(?<host>[^:/]+)[:/](?<path>.+?)(?:\.git)?\z}
GIT_HTTPS_REGEXP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%r{\Ahttps://(?<host>[^/]+)/(?<path>.+?)(?:\.git)?\z}
WILDCARD =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'/*'
WILDCARD_RANGE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

(..-WILDCARD.length)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_from_git(world) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
24
25
# File 'lib/mutant/license/subscription/repository.rb', line 21

def self.load_from_git(world)
  world
    .capture_stdout(%w[git remote --verbose])
    .fmap(&method(:parse_remotes))
end

.parse(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
35
# File 'lib/mutant/license/subscription/repository.rb', line 32

def self.parse(input)
  host, path = *input.split('/', 2).map(&:downcase)
  new(host: host, path: path)
end

Instance Method Details

#allow?(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


56
57
58
# File 'lib/mutant/license/subscription/repository.rb', line 56

def allow?(other)
  other.host.eql?(host) && path_match?(other.path)
end

#to_sObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/mutant/license/subscription/repository.rb', line 17

def to_s
  [host, path].join('/')
end