diff options
Diffstat (limited to 'lib/gitlab/ci/variables/collection.rb')
-rw-r--r-- | lib/gitlab/ci/variables/collection.rb | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/lib/gitlab/ci/variables/collection.rb b/lib/gitlab/ci/variables/collection.rb index 2f5987f2846..83db5492d43 100644 --- a/lib/gitlab/ci/variables/collection.rb +++ b/lib/gitlab/ci/variables/collection.rb @@ -4,8 +4,6 @@ module Gitlab class Collection include Enumerable - Variable = Struct.new(:key, :value, :public, :file) - def initialize(variables = []) @variables = [] @@ -13,7 +11,7 @@ module Gitlab end def append(resource) - @variables.append(fabricate(resource)) + @variables.append(Collection::Item.fabricate(resource)) end def each @@ -27,35 +25,8 @@ module Gitlab end end - ## - # If `file: true` has been provided we expose it, otherwise we - # don't expose `file` attribute at all (stems from what the runner - # expects). - # def to_runner_variables - self.map do |variable| - variable.to_h.reject do |component, value| - component == :file && value == false - end - end - end - - private - - def fabricate(resource) - case resource - when Hash - Collection::Variable.new(resource.fetch(:key), - resource.fetch(:value), - resource.fetch(:public, false), - resource.fetch(:file, false)) - when ::Ci::Variable - Variable.new(resource.key, resource.value, false, false) - when Collection::Variable - resource.dup - else - raise ArgumentError, 'Unknown CI/CD variable resource!' - end + self.map(&:to_hash) end end end |