Sha256: 58e9f6e055cb6df7185ce352b2812bf781f29962d3c98af381348dc7b39ed738

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

class Fixnum
  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
  def div(n)
    (self / n).round
  end unless method_defined? :div

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

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
  def fdiv(n)
    to_f / n
  end unless method_defined? :fdiv

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

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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
marcandre-backports-1.5.0 lib/backports/fixnum.rb
backports-1.5.0 lib/backports/fixnum.rb