Class: Bankai::Docker::Command
- Inherits:
-
Object
- Object
- Bankai::Docker::Command
- Defined in:
- lib/bankai/docker/command.rb
Overview
The docker command
Instance Method Summary collapse
-
#args ⇒ Object
TODO: Prevent use getter as helper method name.
-
#initialize(type, *args, options: {}, mode: nil) ⇒ Command
constructor
A new instance of Command.
- #options ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type, *args, options: {}, mode: nil) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 12 |
# File 'lib/bankai/docker/command.rb', line 7 def initialize(type, *args, options: {}, mode: nil) @type = type.to_s.upcase @args = args @options = @mode = mode end |
Instance Method Details
#args ⇒ Object
TODO: Prevent use getter as helper method name
19 20 21 22 23 |
# File 'lib/bankai/docker/command.rb', line 19 def args return @args.to_s if @mode == :array @args.join(' ') end |
#options ⇒ Object
25 26 27 28 29 |
# File 'lib/bankai/docker/command.rb', line 25 def @options.map do |key, value| "--#{key}=#{value}" end.compact.join(' ') end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/bankai/docker/command.rb', line 14 def to_s "#{@type} #{} #{args}" end |