Class: Ace::GitCommit::Models::CommitOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/git_commit/models/commit_options.rb

Overview

CommitOptions encapsulates all options for a commit operation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(intention: nil, message: nil, model: nil, files: [], only_staged: false, dry_run: false, debug: false, force: false, verbose: true, quiet: false, no_split: false) ⇒ CommitOptions



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ace/git_commit/models/commit_options.rb', line 11

def initialize(
  intention: nil,
  message: nil,
  model: nil,
  files: [],
  only_staged: false,
  dry_run: false,
  debug: false,
  force: false,
  verbose: true,
  quiet: false,
  no_split: false
)
  @intention = intention
  @message = message
  @model = model
  @files = files || []
  @only_staged = only_staged
  @dry_run = dry_run
  @debug = debug
  @force = force
  @verbose = verbose
  @quiet = quiet
  @no_split = no_split
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def debug
  @debug
end

#dry_runObject

Returns the value of attribute dry_run.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def dry_run
  @dry_run
end

#filesObject

Returns the value of attribute files.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def files
  @files
end

#forceObject

Returns the value of attribute force.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def force
  @force
end

#intentionObject

Returns the value of attribute intention.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def intention
  @intention
end

#messageObject

Returns the value of attribute message.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def message
  @message
end

#modelObject

Returns the value of attribute model.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def model
  @model
end

#no_splitObject

Returns the value of attribute no_split.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def no_split
  @no_split
end

#only_stagedObject

Returns the value of attribute only_staged.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def only_staged
  @only_staged
end

#quietObject

Returns the value of attribute quiet.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def quiet
  @quiet
end

#verboseObject

Returns the value of attribute verbose.



8
9
10
# File 'lib/ace/git_commit/models/commit_options.rb', line 8

def verbose
  @verbose
end

Instance Method Details

#specific_files?Boolean

Check if specific files are targeted



45
46
47
# File 'lib/ace/git_commit/models/commit_options.rb', line 45

def specific_files?
  !@files.empty?
end

#stage_all?Boolean

Check if we should stage all changes



51
52
53
# File 'lib/ace/git_commit/models/commit_options.rb', line 51

def stage_all?
  !@only_staged && !specific_files?
end

#to_hHash

Convert to hash for debugging



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ace/git_commit/models/commit_options.rb', line 57

def to_h
  {
    intention: @intention,
    message: @message,
    model: @model,
    files: @files,
    only_staged: @only_staged,
    dry_run: @dry_run,
    debug: @debug,
    force: @force,
    verbose: @verbose,
    quiet: @quiet,
    no_split: @no_split
  }
end

#use_llm?Boolean

Check if we should use LLM generation



39
40
41
# File 'lib/ace/git_commit/models/commit_options.rb', line 39

def use_llm?
  @message.nil? || @message.empty?
end