diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-22 11:03:44 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-22 11:03:44 +0100 |
commit | c7809d097a472bd237022c727a0f2d280276e6e6 (patch) | |
tree | b54c7b0a7461998f6cd05f59a345501cf1f84e4c /lib/gitlab/ci/pipeline/seed/build.rb | |
parent | 7259ee8532497a7b6bb14f228d985a9637757113 (diff) | |
download | gitlab-ce-c7809d097a472bd237022c727a0f2d280276e6e6.tar.gz |
Fix rubocop offense in pipeline build seed class
Diffstat (limited to 'lib/gitlab/ci/pipeline/seed/build.rb')
-rw-r--r-- | lib/gitlab/ci/pipeline/seed/build.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/gitlab/ci/pipeline/seed/build.rb b/lib/gitlab/ci/pipeline/seed/build.rb index 5f7721ecb2c..f409bf6f164 100644 --- a/lib/gitlab/ci/pipeline/seed/build.rb +++ b/lib/gitlab/ci/pipeline/seed/build.rb @@ -5,9 +5,7 @@ module Gitlab class Build < Seed::Base include Gitlab::Utils::StrongMemoize - attr_reader :pipeline, :attributes - - delegate :dig, to: :attributes + delegate :dig, to: :@attributes def initialize(pipeline, attributes) @pipeline = pipeline @@ -23,6 +21,16 @@ module Gitlab @attributes.merge!(user: current_user) end + def included? + strong_memoize(:inclusion) do + only_specs = Gitlab::Ci::Build::Policy.fabricate(@only) + except_specs = Gitlab::Ci::Build::Policy.fabricate(@except) + + only_specs.all? { |spec| spec.satisfied_by?(@pipeline) } && + except_specs.none? { |spec| spec.satisfied_by?(@pipeline) } + end + end + def attributes @attributes.merge( pipeline: @pipeline, @@ -34,16 +42,6 @@ module Gitlab ) end - def included? - strong_memoize(:inclusion) do - only_specs = Gitlab::Ci::Build::Policy.fabricate(@only) - except_specs = Gitlab::Ci::Build::Policy.fabricate(@except) - - only_specs.all? { |spec| spec.satisfied_by?(pipeline) } && - except_specs.none? { |spec| spec.satisfied_by?(pipeline) } - end - end - def to_resource ::Ci::Build.new(attributes) end |