Class: Yadriggy::NonRubyType
Instance Method Summary collapse
-
#<=(t) ⇒ Boolean
Check the subtype relation.
-
#==(t) ⇒ Boolean
Checks the equality.
-
#initialize(obj_name, type_name) ⇒ NonRubyType
constructor
A new instance of NonRubyType.
- #inspect ⇒ Object
-
#name ⇒ String
Obtains the name of this type.
- #role(t) ⇒ Object
Methods inherited from Type
#!=, #copy, #eql?, error_found!, #exact_type, get_instance_method_object, #get_method_object, #has_role?, #is_super_of?, role, #supertype
Constructor Details
#initialize(obj_name, type_name) ⇒ NonRubyType
Returns a new instance of NonRubyType.
116 117 118 119 |
# File 'lib/yadriggy/type.rb', line 116 def initialize(obj_name, type_name) @obj_name = obj_name @type_name = type_name end |
Instance Method Details
#<=(t) ⇒ Boolean
Check the subtype relation.
138 139 140 |
# File 'lib/yadriggy/type.rb', line 138 def <= (t) self == t || t.is_super_of?(self) end |
#==(t) ⇒ Boolean
Checks the equality.
130 131 132 133 |
# File 'lib/yadriggy/type.rb', line 130 def == (t) r = NonRubyType.role(t) self.equal?(r) end |
#inspect ⇒ Object
147 148 149 |
# File 'lib/yadriggy/type.rb', line 147 def inspect() @obj_name end |
#name ⇒ String
Obtains the name of this type.
123 124 125 |
# File 'lib/yadriggy/type.rb', line 123 def name @type_name end |
#role(t) ⇒ Object
142 143 144 145 |
# File 'lib/yadriggy/type.rb', line 142 def role(t) r = NonRubyType.role(t) self.equal?(r) ? self : nil end |