Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/multiarray.rb
Overview
Object
is extended with a few methods
Instance Method Summary collapse
-
#and(other) ⇒ FalseClass, TrueClass
Boolean ‘and’ operation.
-
#conditional(a, b) ⇒ Object
Boolean select operation.
-
#eq(other) ⇒ FalseClass, ...
Element-wise equal operator.
-
#instance_exec(*arguments, &block) ⇒ Object
Object#instance_exec is defined if it does not exist already.
-
#ne(other) ⇒ FalseClass, ...
Element-wise not-equal operator.
-
#not ⇒ FalseClass
Boolean negation.
-
#or(other) ⇒ TrueClass
Boolean ‘or’ operation.
Instance Method Details
#and(other) ⇒ FalseClass, TrueClass
Boolean ‘and’ operation
102 103 104 105 106 107 108 109 |
# File 'lib/multiarray.rb', line 102 def and( other ) unless other.is_a? Hornetseye::Node other else x, y = other.coerce self x.and y end end |
#conditional(a, b) ⇒ Object
Boolean select operation
171 172 173 |
# File 'lib/multiarray.rb', line 171 def conditional( a, b ) a end |
#eq(other) ⇒ FalseClass, ...
Element-wise equal operator
The method calls self == other unless other
is of type Hornetseye::Node. In that case an element-wise comparison using Hornetseye::Node#eq is performed after coercion.
136 137 138 139 140 141 142 143 |
# File 'lib/multiarray.rb', line 136 def eq( other ) unless other.is_a? Hornetseye::Node self == other else x, y = other.coerce self x.eq y end end |
#instance_exec(*arguments, &block) ⇒ Object
Object#instance_exec is defined if it does not exist already
79 80 81 |
# File 'lib/multiarray.rb', line 79 def instance_exec( *arguments, &block ) block.bind( self )[ *arguments ] end |
#ne(other) ⇒ FalseClass, ...
Element-wise not-equal operator
The method calls ( self == other ).not unless other
is of type Hornetseye::Node. In that case an element-wise comparison using Hornetseye::Node#ne is performed after coercion.
154 155 156 157 158 159 160 161 |
# File 'lib/multiarray.rb', line 154 def ne( other ) unless other.is_a? Hornetseye::Node ( self == other ).not else x, y = other.coerce self x.ne y end end |
#or(other) ⇒ TrueClass
Boolean ‘or’ operation
118 119 120 121 122 123 124 125 |
# File 'lib/multiarray.rb', line 118 def or( other ) unless other.is_a? Hornetseye::Node self else x, y = other.coerce self x.or y end end |