Sha256: 30257cea0468f6d2df66c0f4efde22dcc70d229c69d1c4d1420c88195307365a

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

module SimControl
  class Scenario
    def initialize(*args)
      options = Hash.try_convert(args.last)
      if options
        args.pop
      end
      @commands = args
      @options = options || {}
    end

    def options(other_options = {})
      other_options.merge(@options).map { |k, v| "--#{ k } #{ v }" }.join " "
    end

    def commands
      @commands.join(" ").strip
    end

    def args(other_options = {})
      [commands, options(other_options)].join(" ").strip
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
SimControl-0.1.4 lib/SimControl/scenario.rb