Module: Uinit::Type

Defined in:
lib/uinit/type.rb,
lib/uinit/type/fn.rb,
lib/uinit/type/base.rb,
lib/uinit/type/impl.rb,
lib/uinit/type/type.rb,
lib/uinit/type/check.rb,
lib/uinit/type/const.rb,
lib/uinit/type/error.rb,
lib/uinit/type/set_of.rb,
lib/uinit/type/context.rb,
lib/uinit/type/generic.rb,
lib/uinit/type/hash_of.rb,
lib/uinit/type/type_of.rb,
lib/uinit/type/version.rb,
lib/uinit/type/array_of.rb,
lib/uinit/type/operators.rb,
lib/uinit/type/composition.rb

Defined Under Namespace

Modules: Context, Operators Classes: ArrayOf, Base, Check, Composition, Const, Error, Fn, Generic, HashOf, Impl, SetOf, Type, TypeOf

Constant Summary collapse

VERSION =
'0.1.4'

Class Method Summary collapse

Class Method Details

.from(arg) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/uinit/type.rb', line 22

def self.from(arg)
  klass =
    [Base, TypeOf, ArrayOf, SetOf, HashOf, Check, Type, Const].find do |type_class|
      type_class.from?(arg)
    end

  klass.from(arg)
end

.is!(type, value) ⇒ Object



18
19
20
# File 'lib/uinit/type.rb', line 18

def self.is!(type, value)
  from(type).is?(value)
end

.is?(type, value) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/uinit/type.rb', line 14

def self.is?(type, value)
  from(type).is?(value)
end