Class: Contracts::Constraints::Type

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

Instance Method Summary collapse

Methods inherited from Base

#to_h

Constructor Details

#initialize(type) ⇒ Type

Returns a new instance of Type.



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

def initialize(type) = @type = type

Instance Method Details

#descriptionObject



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

def description = @type.is_a?(Module) ? @type.name : @type.to_s

#matches?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

def matches?(value) = value.is_a?(@type)