Sha256: a115bb2e20aa1abf8ff6b65ae64d315b01eb083c37d5441db1219ce0d66be7f8

Contents?: true

Size: 340 Bytes

Versions: 1

Compression:

Stored size: 340 Bytes

Contents

module Optionally
  module Required
    def self.included(base)
      base.extend(self)
    end

    def check_required_options(candidate, *required_keys)
      required_keys.each do |key|
        unless candidate.keys.include?(key)
          raise ArgumentError.new("#{key} is required")
        end
      end
      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
optionally-0.0.3 lib/optionally/required.rb