Class: Stitcher::Type
- Includes:
- TypeOperators
- Defined in:
- lib/stitcher/type.rb
Instance Method Summary collapse
- #comp(other, op) ⇒ Object
-
#initialize(klass = nil, &block) ⇒ Type
constructor
A new instance of Type.
- #type ⇒ Object
Methods included from TypeOperators
Constructor Details
#initialize(klass = nil, &block) ⇒ Type
Returns a new instance of Type.
52 53 54 55 56 57 58 59 60 |
# File 'lib/stitcher/type.rb', line 52 def initialize klass = nil, &block @comp = block @comp = lambda do |other, op| # change operator "<" to ">". return other.comp(klass, op.to_s.tr("<>", "><")) if other.class == Type return self.comp(other, :==) if op.to_sym == :=== klass.__send__ op, other.classtype end unless block_given? end |