Module: Vanguard::Matcher::Nullary::Value

Defined in:
lib/vanguard/matcher/nullary/value.rb

Overview

Module for generating value matchers

TODO: Move somehere else

Class Method Summary collapse

Class Method Details

.build(value) ⇒ Matcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build value matcher

Parameters:

  • value (Object)

Returns:



19
20
21
22
23
24
25
26
27
28
# File 'lib/vanguard/matcher/nullary/value.rb', line 19

def self.build(value)
  case value
  when Range
    Inclusion.new(value)
  when Fixnum
    Equality.new(value)
  else
    raise "Cannot build value matcher from: #{value.inspect}"
  end
end