Sha256: 6ce5e1a9ae0393027a3ff5e0b6cd80c5a27ded6b7d66968cc8fa3de4bb0c885e

Contents?: true

Size: 504 Bytes

Versions: 6

Compression:

Stored size: 504 Bytes

Contents

# coding: utf-8
require 'ostruct'

module Bombard
  class Config
    class << self
      def for(opts)
        new opts
      end
    end

    def initialize(opts)
      @opts = opts
    end

    def siege
      @siege ||= opts_for Siege::OPTIONS.map { |k, _| k }
    end

    def bombard
      @bombard ||= OpenStruct.new opts_for(Bombard::Cli::OPTIONS)
    end

  private

    def opts_for(const)
      @opts.select { |k, _| const.include?(k.to_sym) }.hmap { |k, v| {k.to_sym => v} }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bombard-0.1.0 lib/bombard/config.rb
bombard-0.0.6 lib/bombard/config.rb
bombard-0.0.5 lib/bombard/config.rb
bombard-0.0.4 lib/bombard/config.rb
bombard-0.0.3 lib/bombard/config.rb
bombard-0.0.2 lib/bombard/config.rb