Class: Module
Instance Method Summary collapse
- #<(object) ⇒ Object
- #<=(object) ⇒ Object
- #<=>(object) ⇒ Object
- #===(object) ⇒ Object
- #>(object) ⇒ Object
- #>=(object) ⇒ Object
-
#case_compare ⇒ Object
#.
-
#compare ⇒ Object
<=> #.
-
#greater_than ⇒ Object
> #.
-
#greater_than_or_equal_to ⇒ Object
>= #.
-
#instance_identities ⇒ Array<Object>
Identities that instances of receiver identify as, beyond those which it actually is.
-
#instances_identify_as!(*objects) ⇒ Object
Cause instances of receiver to identify as specified objects.
-
#instances_identify_as?(object) ⇒ true, false
Query whether instances of receiver identify as specified object.
-
#less_than ⇒ Object
< #.
-
#less_than_or_equal_to ⇒ Object
<= #.
-
#stop_instances_identifying_as!(*objects) ⇒ Object
Cause instances of receiver to no longer identify as specified objects.
Instance Method Details
#<(object) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/module.rb', line 84 def <( object ) is_less_than = less_than( object ) if is_less_than.nil? # a class is < another class if it has the other class as one of its ancestors if self != object and ::IdentifiesAs.object_instance_identifies_as?( self, object ) is_less_than = true end end return is_less_than end |
#<=(object) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/module.rb', line 133 def <=( object ) is_less_than_or_equal_to = less_than_or_equal_to( object ) if is_less_than_or_equal_to.nil? # a class is < another class if it has the other class as one of its ancestors if self == object or ::IdentifiesAs.object_instance_identifies_as?( self, object ) is_less_than_or_equal_to = true end end return is_less_than_or_equal_to end |
#<=>(object) ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/module.rb', line 182 def <=>( object ) less_than_equal_to_greater_than = nil if self == object less_than_equal_to_greater_than = 0 elsif self < object less_than_equal_to_greater_than = -1 elsif self > object less_than_equal_to_greater_than = 1 end return less_than_equal_to_greater_than end |
#===(object) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/module.rb', line 62 def ===( object ) is_equal = false if ::IdentifiesAs.respond_to?( :object_identifies_as? ) and ::IdentifiesAs.case_compare( object ) and ::IdentifiesAs.object_identifies_as?( object, self ) is_equal = true else is_equal = case_compare( object ) end return is_equal end |
#>(object) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/module.rb', line 106 def >( object ) is_greater_than = greater_than( object ) if is_greater_than.nil? # a class is > another class if the other class has it as one of its ancestors if self != object and ::IdentifiesAs.object_instance_identifies_as?( object, self ) is_greater_than = true else is_less_than = self < object unless is_less_than.nil? is_greater_than = ! is_less_than end end end return is_greater_than end |
#>=(object) ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/module.rb', line 155 def >=( object ) is_greater_than_or_equal_to = greater_than_or_equal_to( object ) if is_greater_than_or_equal_to.nil? # a class is < another class if it has the other class as one of its ancestors if self == object or ::IdentifiesAs.object_instance_identifies_as?( object, self ) is_greater_than_or_equal_to = true else is_less_than_or_equal_to = self <= object unless is_less_than_or_equal_to.nil? is_greater_than_or_equal_to = ! is_less_than_or_equal_to end end end return is_greater_than_or_equal_to end |
#greater_than_or_equal_to ⇒ Object
>= #
153 |
# File 'lib/module.rb', line 153 alias_method :greater_than_or_equal_to, :>= |
#instance_identities ⇒ Array<Object>
Identities that instances of receiver identify as, beyond those which it actually is.
37 38 39 40 41 |
# File 'lib/module.rb', line 37 def instance_identities return ::IdentifiesAs.object_instance_identities( self ) end |
#instances_identify_as!(*objects) ⇒ Object
Cause instances of receiver to identify as specified objects.
11 12 13 14 15 |
# File 'lib/module.rb', line 11 def instances_identify_as!( *objects ) return ::IdentifiesAs.object_instances_identify_as!( self, *objects ) end |
#instances_identify_as?(object) ⇒ true, false
Query whether instances of receiver identify as specified object.
24 25 26 27 28 |
# File 'lib/module.rb', line 24 def instances_identify_as?( object ) return ::IdentifiesAs.object_instances_identify_as?( self, object ) end |
#less_than_or_equal_to ⇒ Object
<= #
131 |
# File 'lib/module.rb', line 131 alias_method :less_than_or_equal_to, :<= |
#stop_instances_identifying_as!(*objects) ⇒ Object
Cause instances of receiver to no longer identify as specified objects.
50 51 52 53 54 |
# File 'lib/module.rb', line 50 def ( *objects ) return ::IdentifiesAs.( self, *objects ) end |