Class: Integer
- Defined in:
- lib/backports/1.9/integer.rb,
lib/backports/1.8.7/integer.rb
Instance Method Summary collapse
-
#even? ⇒ Boolean
Standard in ruby 1.8.7+.
-
#odd? ⇒ Boolean
Standard in ruby 1.8.7+.
-
#ord ⇒ Object
Standard in ruby 1.8.7+.
-
#pred ⇒ Object
Standard in ruby 1.8.7+.
Instance Method Details
#even? ⇒ Boolean
Standard in ruby 1.8.7+. See official documentation
5 6 7 |
# File 'lib/backports/1.8.7/integer.rb', line 5 def even? self[0].zero? end |
#odd? ⇒ Boolean
Standard in ruby 1.8.7+. See official documentation
10 11 12 |
# File 'lib/backports/1.8.7/integer.rb', line 10 def odd? !even? end |
#ord ⇒ Object
Standard in ruby 1.8.7+. See official documentation
15 16 17 |
# File 'lib/backports/1.8.7/integer.rb', line 15 def ord self end |
#pred ⇒ Object
Standard in ruby 1.8.7+. See official documentation
20 21 22 |
# File 'lib/backports/1.8.7/integer.rb', line 20 def pred self - 1 end |