Class: Diogenes::DSL::Artifact
- Inherits:
-
Object
- Object
- Diogenes::DSL::Artifact
- Defined in:
- lib/diogenes/dsl/artifact.rb,
sig/generated/diogenes/dsl/artifact.rbs
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
: String.
Instance Method Summary collapse
-
#description(value = nil) ⇒ String?
: (?String?) -> String?.
-
#initialize(name, &block) ⇒ Artifact
constructor
: (String, ?Proc) -> void.
-
#template(value = nil) ⇒ String?
: (?String?) -> String?.
-
#validate! ⇒ void
: () -> void.
Constructor Details
#initialize(name, &block) ⇒ Artifact
: (String, ?Proc) -> void
10 11 12 13 14 |
# File 'lib/diogenes/dsl/artifact.rb', line 10 def initialize(name, &block) @name = name #: String instance_eval(&block) if block_given? validate! end |
Instance Attribute Details
#name ⇒ String (readonly)
: String
7 8 9 |
# File 'lib/diogenes/dsl/artifact.rb', line 7 def name @name end |
Instance Method Details
#description(value = nil) ⇒ String?
: (?String?) -> String?
17 18 19 20 |
# File 'lib/diogenes/dsl/artifact.rb', line 17 def description(value = nil) @description = value unless value.nil? @description end |
#template(value = nil) ⇒ String?
: (?String?) -> String?
23 24 25 26 |
# File 'lib/diogenes/dsl/artifact.rb', line 23 def template(value = nil) @template = value unless value.nil? @template end |
#validate! ⇒ void
This method returns an undefined value.
: () -> void
31 32 33 34 35 36 37 38 39 |
# File 'lib/diogenes/dsl/artifact.rb', line 31 def validate! missing = %i[description template].reject { |f| instance_variable_get(:"@#{f}") } return if missing.empty? raise Diogenes::ConfigurationError, "Artifact #{@name.inspect} is missing required " \ "field#{"s" if missing.size > 1}: #{missing.join(", ")}. " \ "An artifact requires: description and template." end |