Sha256: 5c1e1e6eb62d9e89b85710fdafa55dc8a2ddfb0b68e6ae4cb5917d0bcad1f6f6

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

#
# Compatibility for older rubies
#

unless Object.method_defined?(:__send)
  class Object
    alias __send __send__
  end
end

unless Object.method_defined?(:funcall)
  class Object
    alias funcall __send
  end
end

unless Fixnum.method_defined?(:ord)
  class Fixnum
    def ord
      self
    end
  end
end

unless String.method_defined?(:lines)
  class String
    alias lines to_a
  end
end

unless String.method_defined?(:bytesize)
  class String
    alias bytesize size
  end
end

def fopen(*args, &block)
  option = args[1]
  if option and !Object.const_defined?(:Encoding)
    args[1] = option.sub(/:.*\z/, '')
  end
  File.open(*args, &block)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bitclust-core-0.9.3 lib/bitclust/compat.rb
bitclust-core-0.9.2 lib/bitclust/compat.rb
bitclust-core-0.9.1 lib/bitclust/compat.rb
bitclust-core-0.9.0 lib/bitclust/compat.rb
bitclust-core-0.8.0 lib/bitclust/compat.rb