Class: KKGit::AutoFormat::Tool

Inherits:
Struct
  • Object
show all
Defined in:
lib/kk/git/auto_format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argvObject

Returns the value of attribute argv

Returns:

  • (Object)

    the current value of argv



10
11
12
# File 'lib/kk/git/auto_format.rb', line 10

def argv
  @argv
end

#binObject

Returns the value of attribute bin

Returns:

  • (Object)

    the current value of bin



10
11
12
# File 'lib/kk/git/auto_format.rb', line 10

def bin
  @bin
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



10
11
12
# File 'lib/kk/git/auto_format.rb', line 10

def name
  @name
end

Instance Method Details

#build(files, repo_dir:) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/kk/git/auto_format.rb', line 11

def build(files, repo_dir:)
  bin_path = AutoFormat.resolve_bin(bin, repo_dir: repo_dir)
  return nil unless bin_path

  args = argv.flat_map { |part| part == '%{files}' ? files : [part] }
  [bin_path, *args]
end