Class: Gitlab::Ci::Config::External::File::Remote
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/config/external/file/remote.rb
Constant Summary
Constants inherited from Base
Base::YAML_WHITELIST_EXTENSION
Instance Attribute Summary
Attributes inherited from Base
#context, #errors, #location, #params
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(params, context) ⇒ Remote
constructor
A new instance of Remote.
- #metadata ⇒ Object
- #validate_context! ⇒ Object
- #validate_location! ⇒ Object
Methods inherited from Base
#eql?, #error_message, #hash, #invalid_extension?, #invalid_location_type?, #load_and_validate_expanded_hash!, #matching?, #preload_content, #preload_context, #to_hash, #valid?, #validate_content!
Constructor Details
#initialize(params, context) ⇒ Remote
Returns a new instance of Remote.
11 12 13 14 15 |
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 11 def initialize(params, context) @location = params[:remote] super end |
Instance Method Details
#content ⇒ Object
17 18 19 |
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 17 def content strong_memoize(:content) { fetch_remote_content } end |
#metadata ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 21 def super.merge( type: :remote, location: masked_location, blob: nil, raw: masked_location, extra: {} ) end |
#validate_context! ⇒ Object
31 32 33 |
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 31 def validate_context! # no-op end |
#validate_location! ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 35 def validate_location! super unless ::Gitlab::UrlSanitizer.valid?(location) errors.push("Remote file `#{masked_location}` does not have a valid address!") end end |