Sha256: 816445bb01750eb75a05b134ec34e92a96a774076c5ffb0635853dd9c55fd07a

Contents?: true

Size: 501 Bytes

Versions: 6

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 = {})
      [options(other_options), commands].join(" ").strip
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
SimControl-0.1.10 lib/SimControl/scenario.rb
SimControl-0.1.9 lib/SimControl/scenario.rb
SimControl-0.1.8 lib/SimControl/scenario.rb
SimControl-0.1.7 lib/SimControl/scenario.rb
SimControl-0.1.6 lib/SimControl/scenario.rb
SimControl-0.1.5 lib/SimControl/scenario.rb