Class: Vx::Builder::BuildConfiguration::Deploy::Base
- Inherits:
-
Object
- Object
- Vx::Builder::BuildConfiguration::Deploy::Base
- Defined in:
- lib/vx/builder/build_configuration/deploy/base.rb
Direct Known Subclasses
Constant Summary collapse
- @@loaded =
[]
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
- .detect(params) ⇒ Object
- .key ⇒ Object
- .loaded ⇒ Object
- .module_by_key(val) ⇒ Object
- .provide(val) ⇒ Object
Instance Method Summary collapse
- #branch?(name) ⇒ Boolean
-
#initialize(params) ⇒ Base
constructor
A new instance of Base.
- #key ⇒ Object
- #to_commands ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(params) ⇒ Base
Returns a new instance of Base.
36 37 38 39 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 36 def initialize(params) @params = params.is_a?(Hash) ? params : {} self.branch = params["branch"] end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
34 35 36 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 34 def branch @branch end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
34 35 36 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 34 def params @params end |
Class Method Details
.detect(params) ⇒ Object
25 26 27 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 25 def detect(params) params.key?(key.to_s) if key end |
.key ⇒ Object
21 22 23 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 21 def key @key end |
.loaded ⇒ Object
12 13 14 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 12 def loaded @@loaded end |
.module_by_key(val) ⇒ Object
29 30 31 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 29 def module_by_key(val) loaded.find{|i| i.key.to_s == val.to_s } end |
.provide(val) ⇒ Object
16 17 18 19 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 16 def provide(val) loaded.push self @key = val end |
Instance Method Details
#branch?(name) ⇒ Boolean
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 45 def branch?(name) case when branch.empty? true when !name true else branch.include?(name) end end |
#key ⇒ Object
56 57 58 59 60 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 56 def key if self.class.key @key ||= Array(params[self.class.key.to_s]) end end |
#to_commands ⇒ Object
70 71 72 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 70 def to_commands nil end |
#to_hash ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/vx/builder/build_configuration/deploy/base.rb', line 62 def to_hash if key { self.class.key.to_s => key } else {} end end |