Class: Literal::Types::DeferredType

Inherits:
Object
  • Object
show all
Includes:
Literal::Type
Defined in:
lib/literal/types/deferred_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ DeferredType

Returns a new instance of DeferredType.



6
7
8
# File 'lib/literal/types/deferred_type.rb', line 6

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



10
11
12
# File 'lib/literal/types/deferred_type.rb', line 10

def block
  @block
end

Instance Method Details

#===(other) ⇒ Object



16
17
18
# File 'lib/literal/types/deferred_type.rb', line 16

def ===(other)
  @block.call === other
end

#>=(other) ⇒ Object



20
21
22
# File 'lib/literal/types/deferred_type.rb', line 20

def >=(other)
  Literal.subtype?(other, @block.call)
end

#inspectObject



12
13
14
# File 'lib/literal/types/deferred_type.rb', line 12

def inspect
  "_Deferred"
end