Class: Matrixeval::Variant
- Inherits:
-
Object
- Object
- Matrixeval::Variant
- Defined in:
- lib/matrixeval/variant.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#mounts ⇒ Object
readonly
Returns the value of attribute mounts.
-
#vector ⇒ Object
readonly
Returns the value of attribute vector.
Class Method Summary collapse
Instance Method Summary collapse
- #==(variant) ⇒ Object
- #default? ⇒ Boolean
- #docker_compose_service_name ⇒ Object
- #id ⇒ Object
-
#initialize(config = {}, vector) ⇒ Variant
constructor
A new instance of Variant.
- #match_command_options?(options) ⇒ Boolean
- #name ⇒ Object
- #pathname ⇒ Object
Constructor Details
#initialize(config = {}, vector) ⇒ Variant
Returns a new instance of Variant.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/matrixeval/variant.rb', line 11 def initialize(config = {}, vector) raise Error.new("Variant#key is missing") if config["key"].nil? @vector = vector @key = config["key"].to_s @container = Container.new(config["container"]) @env = config["env"] || {} @default = config["default"] || false @mounts = config["mounts"] || [] end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
9 10 11 |
# File 'lib/matrixeval/variant.rb', line 9 def container @container end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
9 10 11 |
# File 'lib/matrixeval/variant.rb', line 9 def default @default end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
9 10 11 |
# File 'lib/matrixeval/variant.rb', line 9 def env @env end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/matrixeval/variant.rb', line 9 def key @key end |
#mounts ⇒ Object (readonly)
Returns the value of attribute mounts.
9 10 11 |
# File 'lib/matrixeval/variant.rb', line 9 def mounts @mounts end |
#vector ⇒ Object (readonly)
Returns the value of attribute vector.
9 10 11 |
# File 'lib/matrixeval/variant.rb', line 9 def vector @vector end |
Class Method Details
.default(key, vector) ⇒ Object
4 5 6 |
# File 'lib/matrixeval/variant.rb', line 4 def default(key, vector) self.new({"key" => key}, vector) end |
Instance Method Details
#==(variant) ⇒ Object
46 47 48 49 |
# File 'lib/matrixeval/variant.rb', line 46 def ==(variant) vector.key == variant.vector.key && key == variant.key end |
#default? ⇒ Boolean
38 39 40 |
# File 'lib/matrixeval/variant.rb', line 38 def default? default end |
#docker_compose_service_name ⇒ Object
30 31 32 |
# File 'lib/matrixeval/variant.rb', line 30 def docker_compose_service_name id end |
#id ⇒ Object
26 27 28 |
# File 'lib/matrixeval/variant.rb', line 26 def id "#{vector.id}_#{key.to_s.gsub(/[^A-Za-z0-9]/,'_')}" end |
#match_command_options?(options) ⇒ Boolean
42 43 44 |
# File 'lib/matrixeval/variant.rb', line 42 def () [vector.key] == key.to_s end |
#name ⇒ Object
22 23 24 |
# File 'lib/matrixeval/variant.rb', line 22 def name "#{vector.key}: #{key}" end |
#pathname ⇒ Object
34 35 36 |
# File 'lib/matrixeval/variant.rb', line 34 def pathname id end |