Class: Contracts::Constraints::Range

Inherits:
Base
  • Object
show all
Defined in:
lib/contracts.rb

Instance Method Summary collapse

Methods inherited from Base

#to_h

Constructor Details

#initialize(range) ⇒ Range

Returns a new instance of Range.



240
# File 'lib/contracts.rb', line 240

def initialize(range) = @range = range

Instance Method Details

#descriptionObject



242
# File 'lib/contracts.rb', line 242

def description = "in #{@range.inspect}"

#matches?(value) ⇒ Boolean

Returns:

  • (Boolean)


241
# File 'lib/contracts.rb', line 241

def matches?(value) = @range.cover?(value)