Class: Symbolic::Variable
- Inherits:
-
Object
- Object
- Symbolic::Variable
- Includes:
- AST
- Defined in:
- lib/symbolic_ext/variable.rb
Direct Known Subclasses
Instance Method Summary collapse
- #!=(obj) ⇒ Object
- #<(obj) ⇒ Object
- #<=(obj) ⇒ Object
- #==(obj) ⇒ Object
- #>(obj) ⇒ Object
- #>=(obj) ⇒ Object
- #and(obj) ⇒ Object
- #or(obj) ⇒ Object
Methods included from AST
Instance Method Details
#!=(obj) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/symbolic_ext/variable.rb', line 29 def !=(obj) if obj.is_a?(Variable) || obj.is_a?(Numeric) return object_id == obj.object_id ? false : nil end return !self if obj.equal?(true) return self if obj.equal?(false) return false if obj.equal?(self) nil end |
#<(obj) ⇒ Object
21 22 23 |
# File 'lib/symbolic_ext/variable.rb', line 21 def <(obj) eql?(obj) ? false : nil end |
#<=(obj) ⇒ Object
56 57 58 |
# File 'lib/symbolic_ext/variable.rb', line 56 def <=(obj) object_id == obj.object_id ? true : nil end |
#==(obj) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/symbolic_ext/variable.rb', line 40 def ==(obj) if obj.is_a?(Variable) || obj.is_a?(Numeric) result = object_id == obj.object_id ? true : nil return result end return !self if obj.equal?(false) return self if obj.equal?(true) return true if obj.equal?(self) nil end |
#>(obj) ⇒ Object
25 26 27 |
# File 'lib/symbolic_ext/variable.rb', line 25 def >(obj) eql?(obj) ? false : nil end |
#>=(obj) ⇒ Object
52 53 54 |
# File 'lib/symbolic_ext/variable.rb', line 52 def >=(obj) object_id == obj.object_id ? true : nil end |
#and(obj) ⇒ Object
9 10 11 12 13 |
# File 'lib/symbolic_ext/variable.rb', line 9 def and(obj) return self if obj.equal?(true) || obj.equal?(self) return false if obj.equal?(false) nil end |
#or(obj) ⇒ Object
15 16 17 18 19 |
# File 'lib/symbolic_ext/variable.rb', line 15 def or(obj) return self if obj.equal?(false) || obj.equal?(self) return true if obj.equal?(true) nil end |