Class: Performa::Stage
- Inherits:
-
Object
- Object
- Performa::Stage
- Defined in:
- lib/performa/stage.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, commands:) ⇒ Stage
constructor
A new instance of Stage.
Constructor Details
#initialize(name:, commands:) ⇒ Stage
Returns a new instance of Stage.
20 21 22 23 24 |
# File 'lib/performa/stage.rb', line 20 def initialize(name:, commands:) @name = name @commands = commands @hash = Digest::SHA1.hexdigest(@name + @commands.map(&:hash).join) end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
18 19 20 |
# File 'lib/performa/stage.rb', line 18 def commands @commands end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
18 19 20 |
# File 'lib/performa/stage.rb', line 18 def hash @hash end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/performa/stage.rb', line 18 def name @name end |
Class Method Details
.from_config(config_stage, image:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/performa/stage.rb', line 7 def self.from_config(config_stage, image:) hash = Digest::SHA1.hexdigest(image) commands = config_stage[1].map do |config_command| hash = Digest::SHA1.hexdigest(hash + config_command) StageCommand.new(config_command, hash: hash) end new(name: config_stage[0], commands: commands) end |