Sha256: a6dfd6bd98d1088413cdbb92e24fe2a5fd24b8a4512a243f93781a99337b9ba6

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 Bytes

Contents

class Integer
  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
  def even?
    self[0].zero?
  end unless method_defined? :even?

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
  def odd?
    !even?
  end unless method_defined? :odd?

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
  def ord
    self
  end unless method_defined? :ord

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
  def pred
    self - 1
  end unless method_defined? :pred

  alias_method :magnitude, :abs unless method_defined? :magnitude

  make_block_optional :downto, :times, :upto, :test_on => 42, :arg => 42
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
marcandre-backports-1.7.0 lib/backports/integer.rb
marcandre-backports-1.7.1 lib/backports/integer.rb
backports-1.7.1 lib/backports/integer.rb
backports-1.7.0 lib/backports/integer.rb