Class: Finitio::AnyType
- Inherits:
-
Type
- Object
- Type
- Finitio::AnyType
show all
- Defined in:
- lib/finitio/type/any_type.rb,
lib/finitio/generation/any_type.rb,
lib/finitio/json_schema/any_type.rb
Overview
An AnyType generator allows capuring the set of every ruby citizen as a Finitio type.
Any := .
Object is used as concrete representation of the information type as the Ruby ‘Object` class already captures everything.
R(.) = Object
Accordingly, the ‘dress` transformation function has the signature below. Note that dress always succeeds and returns its first argument.
dress :: Alpha -> Object throws TypeError
dress :: Object -> Object throws TypeError
Constant Summary
Constants included
from Metadata
Metadata::EMPTY_METADATA
Instance Method Summary
collapse
Methods inherited from Type
#anonymous?, #name, #name=, #named?, #to_s, #unconstrained
Methods included from Metadata
#metadata, #metadata=, #metadata?
Constructor Details
#initialize(name = nil, metadata = nil) ⇒ AnyType
Returns a new instance of AnyType.
21
22
23
|
# File 'lib/finitio/type/any_type.rb', line 21
def initialize(name = nil, metadata = nil)
super(name, metadata)
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
49
50
51
|
# File 'lib/finitio/type/any_type.rb', line 49
def ==(other)
super || other.is_a?(AnyType)
end
|
#_suppremum(other) ⇒ Object
45
46
47
|
# File 'lib/finitio/type/any_type.rb', line 45
def _suppremum(other)
self
end
|
#default_name ⇒ Object
25
26
27
|
# File 'lib/finitio/type/any_type.rb', line 25
def default_name
"Any"
end
|
#dress(value, handler = nil) ⇒ Object
37
38
39
|
# File 'lib/finitio/type/any_type.rb', line 37
def dress(value, handler = nil)
value
end
|
#generate_data(generator, world = nil) ⇒ Object
4
5
6
7
8
|
# File 'lib/finitio/generation/any_type.rb', line 4
def generate_data(generator, world = nil)
candidates = [NilClass, String, Integer, Float]
type = generator.flip_one_out_of(candidates)
generator.heuristic.call(type, generator, world)
end
|
#hash ⇒ Object
54
55
56
|
# File 'lib/finitio/type/any_type.rb', line 54
def hash
self.class.hash ^ 37
end
|
#include?(value) ⇒ Boolean
33
34
35
|
# File 'lib/finitio/type/any_type.rb', line 33
def include?(value)
true
end
|
#representator ⇒ Object
29
30
31
|
# File 'lib/finitio/type/any_type.rb', line 29
def representator
Object
end
|
#resolve_proxies(system) ⇒ Object
58
59
60
|
# File 'lib/finitio/type/any_type.rb', line 58
def resolve_proxies(system)
self
end
|
#suppremum(other) ⇒ Object
41
42
43
|
# File 'lib/finitio/type/any_type.rb', line 41
def suppremum(other)
self
end
|
#to_json_schema(*args, &bl) ⇒ Object
4
5
6
|
# File 'lib/finitio/json_schema/any_type.rb', line 4
def to_json_schema(*args, &bl)
{}
end
|