Class: Carson::Parcel
- Inherits:
-
Object
- Object
- Carson::Parcel
- 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
-
#head ⇒ Object
readonly
Returns the value of attribute head.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#shelf ⇒ Object
readonly
Returns the value of attribute shelf.
Instance Method Summary collapse
-
#initialize(label:, head:, shelf: nil) ⇒ Parcel
constructor
A new instance of Parcel.
-
#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.
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
#head ⇒ Object (readonly)
Returns the value of attribute head.
14 15 16 |
# File 'lib/carson/parcel.rb', line 14 def head @head end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
14 15 16 |
# File 'lib/carson/parcel.rb', line 14 def label @label end |
#shelf ⇒ Object (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.
24 25 26 |
# File 'lib/carson/parcel.rb', line 24 def on_main?( main_label ) label == main_label end |