Class: Carson::Parcel

Inherits:
Object
  • Object
show all
Defined in:
lib/carson/parcel.rb

Overview

The committed changes being delivered. Knows its label (branch), head (commit SHA), and shelf (worktree). The protagonist of every delivery — without a parcel, there is nothing to deliver.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, head:, shelf: nil) ⇒ Parcel

Returns a new instance of Parcel.



16
17
18
19
20
# File 'lib/carson/parcel.rb', line 16

def initialize( label:, head:, shelf: nil )
	@label = label
	@head = head
	@shelf = shelf
end

Instance Attribute Details

#headObject (readonly)

Returns the value of attribute head.



14
15
16
# File 'lib/carson/parcel.rb', line 14

def head
  @head
end

#labelObject (readonly)

Returns the value of attribute label.



14
15
16
# File 'lib/carson/parcel.rb', line 14

def label
  @label
end

#shelfObject (readonly)

Returns the value of attribute shelf.



14
15
16
# File 'lib/carson/parcel.rb', line 14

def shelf
  @shelf
end

Instance Method Details

#on_main?(main_label) ⇒ Boolean

Is this parcel sitting on the main shelf? The main shelf is the destination — you cannot deliver FROM the destination.

Returns:

  • (Boolean)


24
25
26
# File 'lib/carson/parcel.rb', line 24

def on_main?( main_label )
	label == main_label
end