Class: Qrb::AnyType
Overview
An AnyType generator allows capuring the set of every ruby citizen as a Q 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
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #default_name ⇒ Object
- #dress(value, handler = nil) ⇒ Object
- #hash ⇒ Object
- #include?(value) ⇒ Boolean
-
#initialize(name = nil) ⇒ AnyType
constructor
A new instance of AnyType.
Methods inherited from Type
Constructor Details
#initialize(name = nil) ⇒ AnyType
Returns a new instance of AnyType.
21 22 23 |
# File 'lib/qrb/type/any_type.rb', line 21 def initialize(name = nil) super(name) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
37 38 39 |
# File 'lib/qrb/type/any_type.rb', line 37 def ==(other) other.is_a?(AnyType) end |
#default_name ⇒ Object
25 26 27 |
# File 'lib/qrb/type/any_type.rb', line 25 def default_name "Any" end |
#dress(value, handler = nil) ⇒ Object
33 34 35 |
# File 'lib/qrb/type/any_type.rb', line 33 def dress(value, handler = nil) value end |
#hash ⇒ Object
42 43 44 |
# File 'lib/qrb/type/any_type.rb', line 42 def hash self.class.hash ^ 37 end |
#include?(value) ⇒ Boolean
29 30 31 |
# File 'lib/qrb/type/any_type.rb', line 29 def include?(value) true end |