Class: Leg::Representations::Git::State

Inherits:
Object
  • Object
show all
Defined in:
lib/leg/representations/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeState

Returns a new instance of State.



345
346
347
348
349
350
# File 'lib/leg/representations/git.rb', line 345

def initialize
  @step_number = nil
  @operation = nil
  @args = []
  @conflict = false
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



343
344
345
# File 'lib/leg/representations/git.rb', line 343

def args
  @args
end

#conflictObject

Returns the value of attribute conflict.



343
344
345
# File 'lib/leg/representations/git.rb', line 343

def conflict
  @conflict
end

#operationObject

Returns the value of attribute operation.



343
344
345
# File 'lib/leg/representations/git.rb', line 343

def operation
  @operation
end

#step_numberObject

Returns the value of attribute step_number.



343
344
345
# File 'lib/leg/representations/git.rb', line 343

def step_number
  @step_number
end

Instance Method Details

#add_commit!Object



357
358
359
360
361
362
363
364
365
366
367
# File 'lib/leg/representations/git.rb', line 357

def add_commit!
  if @operation.nil?
    @operation = :commit
    @args = [1, false]
  elsif @operation == :commit
    @args[0] += 1
  else
    raise "@operation must be :commit or nil"
  end
  self
end

#amend!Object



369
370
371
372
373
374
375
376
377
378
379
# File 'lib/leg/representations/git.rb', line 369

def amend!
  if @operation.nil?
    @operation = :commit
    @args = [0, true]
  elsif @operation == :commit
    @args[1] = true
  else
    raise "@operation must be :commit or nil"
  end
  self
end

#conflict!Object



381
382
383
384
# File 'lib/leg/representations/git.rb', line 381

def conflict!
  @conflict = true
  self
end

#step!(step_number) ⇒ Object



352
353
354
355
# File 'lib/leg/representations/git.rb', line 352

def step!(step_number)
  @step_number = step_number
  self
end