Class: VagrantPlugins::Vocker::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Vocker::Config
- Defined in:
- lib/vocker/config.rb
Instance Attribute Summary collapse
-
#containers ⇒ Object
readonly
Returns the value of attribute containers.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #merge(other) ⇒ Object
- #pull_images(*images) ⇒ Object
- #run(*args) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8 9 10 11 |
# File 'lib/vocker/config.rb', line 8 def initialize @images = Set.new @containers = Hash.new end |
Instance Attribute Details
#containers ⇒ Object (readonly)
Returns the value of attribute containers.
6 7 8 |
# File 'lib/vocker/config.rb', line 6 def containers @containers end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
6 7 8 |
# File 'lib/vocker/config.rb', line 6 def images @images end |
Instance Method Details
#merge(other) ⇒ Object
34 35 36 37 38 |
# File 'lib/vocker/config.rb', line 34 def merge(other) super.tap do |result| result.pull_images *(other.images + self.images) end end |
#pull_images(*images) ⇒ Object
13 14 15 |
# File 'lib/vocker/config.rb', line 13 def pull_images(*images) @images += images.map(&:to_s) end |
#run(*args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vocker/config.rb', line 17 def run(*args) container_name = args.shift params = {} if args.empty? params[:image] = container_name elsif args.first.is_a?(String) params[:image] = args.shift params[:cmd] = container_name else params = args.shift params[:cmd] ||= container_name end @containers[container_name.to_s] = params end |