Method: RubyPython::Operators.rel_op
- Defined in:
- lib/rubypython/operators.rb
.rel_op(rname, pname) ⇒ Object
Creates a method to delegate a relational operator. The result of the delegated method will always be converted to a Ruby type so that simple boolean testing may occur. These methods are implemented with calls the operator module.
- rname
-
The name of the Ruby method for this operation. Can be a Symbol
or a String.
- pname
-
The name of the Python magic method to which this method should
be delegated.
32 33 34 35 36 |
# File 'lib/rubypython/operators.rb', line 32 def self.rel_op(rname, pname) define_method rname.to_sym do |other| RubyPython::Operators.operator_.__send__(pname, self, other).rubify end end |