Class: Coat::Patch
- Inherits:
-
Struct
- Object
- Struct
- Coat::Patch
- Defined in:
- lib/coat/patch.rb
Overview
One patch: what it is, who made it, and what it touched. A patch is only worth something with its origin still attached, so everything needed to judge it travels with it.
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#body ⇒ Object
Returns the value of attribute body.
-
#body_sha256 ⇒ Object
Returns the value of attribute body_sha256.
-
#claims ⇒ Object
Returns the value of attribute claims.
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#cwd ⇒ Object
Returns the value of attribute cwd.
-
#duration_s ⇒ Object
Returns the value of attribute duration_s.
-
#exit ⇒ Object
Returns the value of attribute exit.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#label ⇒ Object
Returns the value of attribute label.
-
#seq ⇒ Object
Returns the value of attribute seq.
-
#ts ⇒ Object
Returns the value of attribute ts.
Class Method Summary collapse
Instance Method Summary collapse
- #command? ⇒ Boolean
-
#failed? ⇒ Boolean
A command that exited non-zero still belongs in the coat - a failed step is evidence too - but it gets marked rather than blending in.
-
#ran? ⇒ Boolean
A patch cut from a command, whether coat ran it or was handed the result.
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def agent @agent end |
#body ⇒ Object
Returns the value of attribute body
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def body @body end |
#body_sha256 ⇒ Object
Returns the value of attribute body_sha256
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def body_sha256 @body_sha256 end |
#claims ⇒ Object
Returns the value of attribute claims
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def claims @claims end |
#cmd ⇒ Object
Returns the value of attribute cmd
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def cmd @cmd end |
#cwd ⇒ Object
Returns the value of attribute cwd
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def cwd @cwd end |
#duration_s ⇒ Object
Returns the value of attribute duration_s
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def duration_s @duration_s end |
#exit ⇒ Object
Returns the value of attribute exit
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def exit @exit end |
#kind ⇒ Object
Returns the value of attribute kind
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def kind @kind end |
#label ⇒ Object
Returns the value of attribute label
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def label @label end |
#seq ⇒ Object
Returns the value of attribute seq
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def seq @seq end |
#ts ⇒ Object
Returns the value of attribute ts
11 12 13 |
# File 'lib/coat/patch.rb', line 11 def ts @ts end |
Class Method Details
.all(entries) ⇒ Object
20 21 22 |
# File 'lib/coat/patch.rb', line 20 def self.all(entries) entries.select { |entry| PATCH_EVENTS.include?(entry["event"]) }.map { |entry| from(entry) } end |
.from(entry) ⇒ Object
16 17 18 |
# File 'lib/coat/patch.rb', line 16 def self.from(entry) new(**entry.slice(*members.map(&:to_s)).transform_keys(&:to_sym)) end |
Instance Method Details
#command? ⇒ Boolean
24 25 26 |
# File 'lib/coat/patch.rb', line 24 def command? kind == "command" end |
#failed? ⇒ Boolean
A command that exited non-zero still belongs in the coat - a failed step is evidence too - but it gets marked rather than blending in.
36 37 38 |
# File 'lib/coat/patch.rb', line 36 def failed? ran? && !exit.zero? end |
#ran? ⇒ Boolean
A patch cut from a command, whether coat ran it or was handed the result. Either way there is an exit status to show.
30 31 32 |
# File 'lib/coat/patch.rb', line 30 def ran? !exit.nil? end |