Sha256: aeebb3624f27dcf793241c8251c6b058af7f0cb0495b8e10be6716a0dc6ea906

Contents?: true

Size: 546 Bytes

Versions: 129

Compression:

Stored size: 546 Bytes

Contents

module Shoulda # :nodoc:
  module Private # :nodoc:
    # Returns the values for the entries in the args hash who's keys are listed in the wanted array.
    # Will raise if there are keys in the args hash that aren't listed.
    def get_options!(args, *wanted)
      ret  = []
      opts = (args.last.is_a?(Hash) ? args.pop : {})
      wanted.each {|w| ret << opts.delete(w)}
      raise ArgumentError, "Unsupported options given: #{opts.keys.join(', ')}" unless opts.keys.empty?
      return wanted.size == 1 ? ret.first : ret
    end
  end
end

Version data entries

129 entries across 99 versions & 18 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/lib/shoulda/private_helpers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/private_helpers.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/private_helpers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.0 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.1 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.10 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.11 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.12 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.13 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.14 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.15 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.16 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.17 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.2 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.3 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.4 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.5 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.6 vendor/gems/shoulda/lib/shoulda/private_helpers.rb
auser-poolparty-1.3.7 vendor/gems/shoulda/lib/shoulda/private_helpers.rb