Class: Typespec::Type

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

Overview

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Type

Returns a new instance of Type.



25
# File 'lib/typespec.rb', line 25

def initialize(type); @type = type; end

Class Method Details

.[](type) ⇒ Object



26
# File 'lib/typespec.rb', line 26

def self.[](type); self.new(type); end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


27
# File 'lib/typespec.rb', line 27

def valid?(value); value.is_a?(@type); end