Sha256: 56c22b4556a9da5e81e6cae56e275f7fa5c527f8e1714d648f51e09982327a66

Contents?: true

Size: 419 Bytes

Versions: 6

Compression:

Stored size: 419 Bytes

Contents

module Metacrunch
  class Job::Dsl::Options::Dsl

    def add(name, *args, default: nil, required: false)
      if default && required
        raise ArgumentError, "You can't use `default` and `required` option at the same time."
      end

      options[name.to_sym] = {
        args: args,
        default: default,
        required: required
      }
    end

    def options
      @options ||= {}
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metacrunch-4.2.0 lib/metacrunch/job/dsl/options/dsl.rb
metacrunch-4.1.1 lib/metacrunch/job/dsl/options/dsl.rb
metacrunch-4.1.0 lib/metacrunch/job/dsl/options/dsl.rb
metacrunch-4.0.3 lib/metacrunch/job/dsl/options/dsl.rb
metacrunch-4.0.2 lib/metacrunch/job/dsl/options/dsl.rb
metacrunch-4.0.1 lib/metacrunch/job/dsl/options/dsl.rb