class Kalculator::Collection
a generic collection type of type Collection
<othertype> where othertype is stored in the type instance variable
Attributes
type[R]
Public Class Methods
new(type)
click to toggle source
# File lib/kalculator/types.rb, line 17 def initialize(type) @type = type end
Public Instance Methods
<=(other_object)
click to toggle source
# File lib/kalculator/types.rb, line 37 def <=(other_object) # otherobject has to be a collection, a type, or some other object if(other_object.class <= Kalculator::Collection) return ((self.class<= other_object.class) and (self.type <= other_object.type)) elsif(other_object.class == Class) if(other_object == Object) return true end return false elsif(other_object.class != Class) return false end return false end
==(other_type)
click to toggle source
# File lib/kalculator/types.rb, line 30 def ==(other_type) #othertype has to be a collection or a type if(other_type.class <= self.class) return other_type.type == self.type end return false end
>=(other_object)
click to toggle source
# File lib/kalculator/types.rb, line 52 def >=(other_object) # otherobject has to be a collection, a type, or some other object if(other_object.class <=Kalculator::Collection) return other_object<= self elsif(other_object.class == Class) return false elsif(other_object.class != Class) return false end return false end
generic_type?(possible_type)
click to toggle source
# File lib/kalculator/types.rb, line 20 def generic_type?(possible_type) #possibleType has to either be a collection or a type if(possible_type.class <= Kalculator::Collection) return possible_type.type <= @type end if(possible_type.class == Class) return possible_type <= @type end return false end