Class: FastIgnore::GitconfigParser

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_ignore/gitconfig_parser.rb

Overview

rubocop:disable Metrics/ClassLength

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, root: Dir.pwd, nesting: 1) ⇒ GitconfigParser

Returns a new instance of GitconfigParser.



12
13
14
15
16
# File 'lib/fast_ignore/gitconfig_parser.rb', line 12

def initialize(path, root: Dir.pwd, nesting: 1)
  @path = path
  @root = root
  @nesting = nesting
end

Class Method Details

.parse(file, root: Dir.pwd, nesting: 1) ⇒ Object



8
9
10
# File 'lib/fast_ignore/gitconfig_parser.rb', line 8

def self.parse(file, root: Dir.pwd, nesting: 1)
  new(file, root: root, nesting: nesting).parse
end

Instance Method Details

#parseObject



18
19
20
21
22
23
24
25
# File 'lib/fast_ignore/gitconfig_parser.rb', line 18

def parse
  raise ::FastIgnore::GitconfigParseError if nesting >= 10

  read_file(path)
  return unless value

  value
end