Module: Pythonism::Pythonize::Numeric
Overview
Provide Numeric methods
Instance Method Summary collapse
- #__add__(other) ⇒ Object
- #__and__(other) ⇒ Object
- #__float__ ⇒ Float
- #__hex__ ⇒ String
- #__int__ ⇒ Object
- #__long__ ⇒ Integer
- #__mod__(other) ⇒ Object
- #__mul__(other) ⇒ Object
- #__oct__ ⇒ String
- #__or__(other) ⇒ Object
- #__sub__(other) ⇒ Object
- #__xor__(other) ⇒ Object
Instance Method Details
#__add__(other) ⇒ Object
28 29 30 |
# File 'lib/pythonism/pythonize/numeric.rb', line 28 def __add__(other) self + other end |
#__and__(other) ⇒ Object
48 49 50 |
# File 'lib/pythonism/pythonize/numeric.rb', line 48 def __and__(other) self & other end |
#__float__ ⇒ Float
13 14 15 |
# File 'lib/pythonism/pythonize/numeric.rb', line 13 def __float__ to_f end |
#__hex__ ⇒ String
23 24 25 |
# File 'lib/pythonism/pythonize/numeric.rb', line 23 def __hex__ format('%x', __int__) end |
#__int__ ⇒ Object
3 4 5 |
# File 'lib/pythonism/pythonize/numeric.rb', line 3 def __int__ to_i end |
#__long__ ⇒ Integer
8 9 10 |
# File 'lib/pythonism/pythonize/numeric.rb', line 8 def __long__ to_i end |
#__mod__(other) ⇒ Object
43 44 45 |
# File 'lib/pythonism/pythonize/numeric.rb', line 43 def __mod__(other) self % other end |
#__mul__(other) ⇒ Object
38 39 40 |
# File 'lib/pythonism/pythonize/numeric.rb', line 38 def __mul__(other) self * other end |
#__oct__ ⇒ String
18 19 20 |
# File 'lib/pythonism/pythonize/numeric.rb', line 18 def __oct__ format('%o', __int__) end |
#__or__(other) ⇒ Object
58 59 60 |
# File 'lib/pythonism/pythonize/numeric.rb', line 58 def __or__(other) self | other end |
#__sub__(other) ⇒ Object
33 34 35 |
# File 'lib/pythonism/pythonize/numeric.rb', line 33 def __sub__(other) self - other end |
#__xor__(other) ⇒ Object
53 54 55 |
# File 'lib/pythonism/pythonize/numeric.rb', line 53 def __xor__(other) self ^ other end |