class Matchi::BeWithin

Wraps the target of a be_within matcher.

Public Class Methods

new(delta) click to toggle source

Initialize a wrapper of the be_within matcher with a numeric value.

@example

require "matchi/be_within"

Matchi::BeWithin.new(1)

@param delta [Numeric] A numeric value.

# File lib/matchi/be_within.rb, line 16
def initialize(delta)
  @delta = delta
end

Public Instance Methods

of(expected) click to toggle source

Specifies an expected numeric value.

@example

require "matchi/be_within"

be_within_wrapper = Matchi::BeWithin.new(1)
be_within_wrapper.of(41)

@param expected [Numeric] The expected value.

@return [#matches?] A *be_within of* matcher.

# File lib/matchi/be_within.rb, line 31
def of(expected)
  Of.new(@delta, expected)
end