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.



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

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

Class Method Details

.[](type) ⇒ Object



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

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

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

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