class ArgumentSpecification::Matchers::Cover
Attributes
values[R]
Public Class Methods
new(*values)
click to toggle source
Create a new matcher instance
Arguments:
values: (Splat)
Example:
>> ArgumentSpecification::Matchers::Cover.new(:a, :b) => #<ArgumentSpecification::Matchers::Cover:0x00000000000000 @values=[:a, :b]>
# File lib/argspec/matchers/cover.rb, line 17 def initialize(*values) @values = values end
Public Instance Methods
matches?()
click to toggle source
Check if the actual object matches
Example:
>> matcher.matches? => true
# File lib/argspec/matchers/cover.rb, line 27 def matches? symbol = @actual.is_a?(Symbol) actual = symbol ? @actual.to_s : @actual values = symbol ? @values.map { |v| v.is_a?(Symbol) ? v.to_s : v } : @values values.each do |value| return false unless actual.include?(value) end true end