class ArgumentSpecification::Matchers::BeOneOf

Attributes

values[R]

Public Class Methods

new(*values) click to toggle source

Create a new matcher instance

Arguments:

values: (Splat|Range)

Example:

>> ArgumentSpecification::Matchers::BeOneOf.new(1, 2)
=> #<ArgumentSpecification::Matchers::BeOneOf:0x00000000000000 @values=[1, 2]>
# File lib/argspec/matchers/be_one_of.rb, line 17
def initialize(*values)
  if values && values.first.is_a?(Range)
    @values = values.first.to_a
  else
    @values = values
  end
end

Public Instance Methods

matches?() click to toggle source

Check if the actual object matches

Example:

>> matcher.matches?
=> true
# File lib/argspec/matchers/be_one_of.rb, line 31
def matches?
  @values.include?(@actual)
end